<div dir="ltr">As Jeremy says, I would ignore AJAX for the moment.<div><br></div><div>Andrew, the page you linked (<a href="http://www.andrewnramage.co.uk/andrew.html" rel="noreferrer" target="_blank">www.andrewnramage.co.uk/andrew.html</a>) 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.</div><div><br></div><div>That has the consequence that we can all see your PHP code, including the (secret) password!</div><div><br></div><div>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.</div><div><br></div><div>Best wishes</div><div>Matthew</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 15 May 2020 at 08:43, Andrew Ramage <<a href="mailto:andrew.ramage.1963@gmail.com">andrew.ramage.1963@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am trying to set it up so that when a valid login is received, a list <br>
of music on the server will be put up on the right half of the screen.  <br>
See <a href="http://www.andrewnramage.co.uk/andrew.html" rel="noreferrer" target="_blank">www.andrewnramage.co.uk/andrew.html</a><br>
<br>
On 14/05/2020 23:58, Jeremy Nicoll wrote:<br>
> On Thu, 14 May 2020, at 21:35, Swithun Crowe wrote:<br>
>> Hello<br>
>><br>
>> AR> When I use an INPUT form to pass variables to a PHP file, echo prints<br>
>> AR> results on a new screen.  How do I get the results printed on the<br>
>> AR> calling page ?<br>
>><br>
>> For this you'll need Javascript. jQuery is quite a user friendly<br>
>> framework.<br>
>><br>
>> To have the form submit data to the server without refreshing the whole<br>
>> page, you need to use AJAX, which you can also do with jQuery.<br>
><br>
> I think AJAX would be .... ambitious for the OP.   I don't think he<br>
> understands what's going on, now.<br>
><br>
> The HTML form (executing in the user's browser) is NOT "passing variables<br>
> to a PHP file".  The user's browser is making a separate (in essence) page<br>
> fetch, from the webserver, asking it to execute the php script on the server<br>
> and is as part of that, including the 'passed' variables' values on the fetch<br>
> request.   The response from that is another web page generated by the<br>
> php script (on the server) which is sent back to the user for their browser<br>
> to display.<br>
><br>
> /Maybe/ if the generated html page returned by that php script also<br>
> contained a copy of the form, with the results displayed somewhere on<br>
> the page one could /appear/ to have displayed results on the original<br>
> page that contained the form... but it is not the same page.<br>
><br>
> The php code on the server is not being called (in the sense that most<br>
> programming languages can call an external function) by any of the code<br>
> (not that there is any) in the original html page.  It's the browser that makes<br>
> the second fetch request, when processing the submit action on the form.<br>
><br>
> As Swithin says, if the OP want's (his) program logic to affect the way any of<br>
> his html pages process things, within the user's browser, that needs to be<br>
> done in JavaScript (or any other supported script language).  That code<br>
> though can't 'call' php stuff on the server either.<br>
><br>
><br>
> It might help if the OP would describe what he thinks he wants the user<br>
> to do and see on these pages.<br>
>   <br>
><br>
<br>
-- <br>
EdLUG mailing list<br>
<a href="mailto:EdLUG@lists.edlug.org.uk" target="_blank">EdLUG@lists.edlug.org.uk</a><br>
<a href="https://lists.edlug.org.uk/mailman/listinfo/edlug" rel="noreferrer" target="_blank">https://lists.edlug.org.uk/mailman/listinfo/edlug</a></blockquote></div>