MoMN MoMN - 1 year ago 40
HTML Question

Filling form data by using url extension; Why does this not work?

I have been trying to pre-fill the subject input with information generated in another page, but have been having difficulties with it despite reading a lot of resources about it and seeing examples. I have tried a variety of links, including my most recent attempt with
, but even that doesn't work. Anybody have any advice? Also, if you want to test it out before answering, the page experiencing the problem is the contact page of this website. I've removed information from below to make it more general. Thanks in advance for any and all of the help.

<form id="contactform" method="post">
<input name="recipient" type="hidden" value="myemail" />
<input name="subject" type="hidden" value="Contacter" />

<p id="contactname">
<input name="name" type="text" />
<p id="contactemail">
<input name="email" type="text" />
<p id="title">
<input name="title" type="text" />
<p id="contactmessage">
<textarea name="message"></textarea>

<p id="submit">
<input type="button" value="Send" />
<input name="redirect" type="hidden" value="myredirectpage" />

Answer Source

Lets say your page URL is some thing like below 

You can use $_GET to get the values of var1, var2,and var3 from the above url

In index.php use the below code to fetch url data

echo $_GET['var1'] // Something
echo $_GET['var2'] // 10
echo $_GET['var3'] // ok

Go through this link