Page 1 of 1
Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:21 am
by lazynewt
Hi I am trying to fill a form out using POST data. As far as i am aware this should work?
Code: Select all
<input type="text" name="name" value="<?php print $_POST['name'] ?>" />
but it doesnt
can anyone point out where i am going wrong. I have also tried echo'ing and thats not working either.
thanks.
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:27 am
by Ziq
Maybe you are using GET method?
Try this:
Code: Select all
<form method="POST">
<input type="text" name="name" value="<?php print $_POST['name'] ?>" />
</form>
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:35 am
by lazynewt
Hi ziq thanks for the reply. I suppose i should of posted a bit more code to go off. Heres whats going on.
form.php
Code: Select all
<form name="demo" onsubmit="return validateFormOnSubmit(this)" action="process.php">
<td><table><tr><td><select name="name">
<option value="mr">mr
<option value="mrs">mrs
</select> </td></tr>
process.php
Code: Select all
<form action="http://www.mysite.com/process" method="post" name="sendtomysite" >
<input type="text" name="name" value="<?php print $_POST['name'] ?>" />
<input name="Submit" value="Send" type="image" src="http://www.mysite.com/image.jpg" />
</p>
</form>
thanks for the help.
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:42 am
by Ziq
Can you edit form?
Code: Select all
<form name="demo" onsubmit="return validateFormOnSubmit(this)" action="process.php" method="POST">
<td><table><tr><td><select name="name">
<option value="mr">mr
<option value="mrs">mrs
</select> </td></tr>
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:45 am
by lazynewt
No joy with using "GET" either Ziq. i am pretty confused as ive found a few references to "auto fill a form using POST data" None of them are working for me and im wondering if the servers im running the code on have some restrictions....
I would of thought it would be possible to use
Code: Select all
<input type="text" name="name" value="<?php echo $_REQUEST["name"]; ?>" />
but this doesnt work either..
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:48 am
by Ziq
Maybe it will help you:
Code: Select all
<input type="text" name="name" value="<?php print $_REQUEST['name'] ?>" />
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 7:52 am
by lazynewt
Hang on a sec ziq i think i might know what im doing and will feel like a bit of a dumb ass if im correct.
Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 8:00 am
by lazynewt
No it turns out im not as much of a dumb ass as i thought. I was originally running form.html but then uploaded a form.php and started testing on that instead. Somehow i navigated to the form.html so i just figured it was that. (its not so just ignore that part of this post if it confuses you lol).
Ok so thanks very much for the help ziq it turns out that
Code: Select all
<input type="php" name="name" value="<?php print $_REQUEST['name'] ?>" />
does work. My only question is why does that work and the rest do not ? any ideas?
thanks ziq i can now stop banging my head against the wall

Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 8:10 am
by Ziq
Sorry, but my English is no so good to understand that you wrote

Maybe someone else will help you. I just started to learn

Re: Trying to fill form using post data. - shouldnt this work?
Posted: Sun Oct 05, 2008 8:12 am
by lazynewt

ok Ziq. i will keep an eye on this topic to see if anyone has any ideas.
p.s Your english seems pretty good to me. Thank you very much for the help.