[EdLUG] Help 10

Matthew Rankine matthew at mrankine.com
Fri May 15 08:29:32 UTC 2020


As Jeremy says, I would ignore AJAX for the moment.

Andrew, the page you linked (www.andrewnramage.co.uk/andrew.html) contains
some PHP scripts, but it is being served as HTML. Instead of the server
recognising it as a php page and executing the code, it is just treating it
as plain text and sending it all to the browser.

That has the consequence that we can all see your PHP code, including the
(secret) password!

As a first step, you could rename the file from andrew.html to andrew.php;
do the same for any other pages containing PHP code; and update any links
and form actions.

Best wishes
Matthew

On Fri, 15 May 2020 at 08:43, Andrew Ramage <andrew.ramage.1963 at gmail.com>
wrote:

> I am trying to set it up so that when a valid login is received, a list
> of music on the server will be put up on the right half of the screen.
> See www.andrewnramage.co.uk/andrew.html
>
> On 14/05/2020 23:58, Jeremy Nicoll wrote:
> > On Thu, 14 May 2020, at 21:35, Swithun Crowe wrote:
> >> Hello
> >>
> >> AR> When I use an INPUT form to pass variables to a PHP file, echo
> prints
> >> AR> results on a new screen.  How do I get the results printed on the
> >> AR> calling page ?
> >>
> >> For this you'll need Javascript. jQuery is quite a user friendly
> >> framework.
> >>
> >> To have the form submit data to the server without refreshing the whole
> >> page, you need to use AJAX, which you can also do with jQuery.
> >
> > I think AJAX would be .... ambitious for the OP.   I don't think he
> > understands what's going on, now.
> >
> > The HTML form (executing in the user's browser) is NOT "passing variables
> > to a PHP file".  The user's browser is making a separate (in essence)
> page
> > fetch, from the webserver, asking it to execute the php script on the
> server
> > and is as part of that, including the 'passed' variables' values on the
> fetch
> > request.   The response from that is another web page generated by the
> > php script (on the server) which is sent back to the user for their
> browser
> > to display.
> >
> > /Maybe/ if the generated html page returned by that php script also
> > contained a copy of the form, with the results displayed somewhere on
> > the page one could /appear/ to have displayed results on the original
> > page that contained the form... but it is not the same page.
> >
> > The php code on the server is not being called (in the sense that most
> > programming languages can call an external function) by any of the code
> > (not that there is any) in the original html page.  It's the browser
> that makes
> > the second fetch request, when processing the submit action on the form.
> >
> > As Swithin says, if the OP want's (his) program logic to affect the way
> any of
> > his html pages process things, within the user's browser, that needs to
> be
> > done in JavaScript (or any other supported script language).  That code
> > though can't 'call' php stuff on the server either.
> >
> >
> > It might help if the OP would describe what he thinks he wants the user
> > to do and see on these pages.
> >
> >
>
> --
> EdLUG mailing list
> EdLUG at lists.edlug.org.uk
> https://lists.edlug.org.uk/mailman/listinfo/edlug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.edlug.org.uk/pipermail/edlug/attachments/20200515/483da2c1/attachment-0001.html>


More information about the EdLUG mailing list