PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 7:21 am
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.
Ziq
Forum Contributor
Posts: 194 Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh
Post
by Ziq » Sun Oct 05, 2008 7:27 am
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>
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 7:35 am
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.
Ziq
Forum Contributor
Posts: 194 Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh
Post
by Ziq » Sun Oct 05, 2008 7:42 am
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>
Last edited by
Ziq on Sun Oct 05, 2008 7:45 am, edited 1 time in total.
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 7:45 am
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..
Last edited by
lazynewt on Sun Oct 05, 2008 7:56 am, edited 2 times in total.
Ziq
Forum Contributor
Posts: 194 Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh
Post
by Ziq » Sun Oct 05, 2008 7:48 am
Maybe it will help you:
Code: Select all
<input type="text" name="name" value="<?php print $_REQUEST['name'] ?>" />
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 7:52 am
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.
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 8:00 am
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
Ziq
Forum Contributor
Posts: 194 Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh
Post
by Ziq » Sun Oct 05, 2008 8:10 am
Sorry, but my English is no so good to understand that you wrote
Maybe someone else will help you. I just started to learn
Last edited by
Ziq on Sun Oct 05, 2008 8:13 am, edited 1 time in total.
lazynewt
Forum Newbie
Posts: 15 Joined: Mon May 19, 2008 10:43 am
Post
by lazynewt » Sun Oct 05, 2008 8:12 am
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.