Passing URL data to form |
Passing URL data to form |
Justin S. |
Apr 19 2016, 12:59 PM
Post
#1
|
Group: Members Posts: 2 Joined: 19-April 16 Member No.: 24,178 |
I'm trying to determine a way to pass URL data into an HTML form. This value would then either populate as a default value when the form is loaded, or just as a hidden form value.
For example, if the URL was: http://www.mydomain.com?variable1="ABC" Then a corresponding form on the page containing an input would contain that value, such as: <input type="hidden" name="variable1" value="ABC"> The end goal then, would be to include that variable/value when the form is submitted. Not sure if this has to be done with javascript or not, or if it can be done with straight HTML. Any help would be greatly appreciated! Thanks! Justin This post has been edited by Justin S.: Apr 19 2016, 01:01 PM |
pandy |
Apr 19 2016, 03:17 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
Not with HTML. It could be done with JavaScript, but if it's important you should rather use a server side programming language.
|
Christian J |
Apr 19 2016, 03:17 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
It can't be done with HTML alone. Javascript can do it, but a server-side script like PHP is more reliable.
Note that a malicious user can manipulate the web page by using a specially crafted URL, so be sure to sanitize the data or compare it with a whitelist in the script before printing it on the web page. Edit: good timing, pandy. |
pandy |
Apr 19 2016, 05:40 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
Not on your part.
|
Justin S. |
Apr 21 2016, 03:29 PM
Post
#5
|
Group: Members Posts: 2 Joined: 19-April 16 Member No.: 24,178 |
Thanks!!
|
Lo-Fi Version | Time is now: 26th April 2024 - 09:06 AM |