[EdLUG] Help 10

Andrew Ramage andrew.ramage.1963 at gmail.com
Fri May 15 07:43:06 UTC 2020


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.
>   
>



More information about the EdLUG mailing list