post

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

Post Reply
amirreza
Forum Newbie
Posts: 3
Joined: Sun May 03, 2009 12:00 pm

post

Post by amirreza »

hi everybody
I am a biginer in php
could you tell me why this code doesn't work

page1.htm

Code: Select all

 
...
<form  action="page2.php" method="post">
<input type="text" name="mytext" />
<input type="submit" value="click me" />
</form>
...
 
page2.php

Code: Select all

 
...
<?php
print $mytext;
?>
...
 
why page2.php show nothing?
thanks
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: post

Post by jazz090 »

you are trying to use globals which is now deprecated, you must use superglobals to access that value:

i.e.

Code: Select all

print $_POST['mytext'];
amirreza
Forum Newbie
Posts: 3
Joined: Sun May 03, 2009 12:00 pm

Re: post

Post by amirreza »

hi jazz090
i just test it and get this error

Parse error: syntax error, unexpected T_PRINT in C:\Inetpub\vhosts\neginled.com\httpdocs\test\test\page2.php on line 3


what can I do?
amirreza
Forum Newbie
Posts: 3
Joined: Sun May 03, 2009 12:00 pm

Re: post

Post by amirreza »

thanks a lot my freand
I had a mistake
it works excellent
Post Reply