Jump to content

Recommended Posts

Not experienced coding PHP and need help doing something which is probably very easy but looks like Mt Everest to me.
Want a web page working locally in Windows 10 local PC that has fields where multiple URL parameters can be filled in:

FOO = 123456

BAR = abc

Then, write URLs with those variables and have them work the same in a browser:

http://webpage1.com/?var1=FOO&var2=BAR
would send 
http://webpage1.com/?var1=123456&var2=abc

http://webpage2.com/?var1=FOO&var2=BAR
would send 
http://webpage2.com/?var1=123456&var2=abc

http://webpage3.com/?var1=FOO&var2=BAR
would send 
http://webpage3.com/?var1=123456&var2=abc

If I update the fields in my local webpage and refresh browser, would like the new value(s) to be used instead.

Any help with this greatly appreciated. If someone will put a file together think that I can edit and modify from there for my specific application.

Thank you.

Edited by Xclone
Link to comment
https://forums.phpfreaks.com/topic/311786-specifiedshared-url-parameters/
Share on other sites

That happens automatically. A lot of how webpages work for folks like us is declarative, meaning that you tell the browser what you want and it will deal with the how.

Give the browser a standard web form, built correctly using the right information for the different pieces (eg, the form inputs will need the names "var1" and "var2"), and it will turn the form data that a user enters into the correct URL.

A skeleton of the form's HTML markup is

<form action="/" method="get">
  <input type="text" name="var1">
  <input type="text" name="var2">
  <button type="submit">Submit</button>
</form>

That contains the absolute bare minimum information to get the behavior you want: entering "FOO" and "BAR" into the two fields and clicking the button will instruct the browser to go to "/?var1=FOO&var2=BAR".

18 minutes ago, Xclone said:

Does anyone know if this will/won't work in that environment

You will if you try it.

Experiment. Planes won't fall out of the sky if get it wrong.

Edited by Barand
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.