Page 1 of 1

post

Posted: Sun May 03, 2009 12:17 pm
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

Re: post

Posted: Sun May 03, 2009 12:30 pm
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'];

Re: post

Posted: Sun May 03, 2009 12:40 pm
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?

Re: post

Posted: Sun May 03, 2009 12:43 pm
by amirreza
thanks a lot my freand
I had a mistake
it works excellent