[PHP] Passing text info using $PHP_SELF
I am using PHP and MySql and wanted to know if it possible to pass the value inserted in a text box back to the page using PHP_SELF. Bellow is the snipped of code. The part that is not working is q=input. Any ideas? Thanks. while($query_data = mysql_fetch_array($result)) { $id = $query_data [q_id]; $q = $query_data [question]; $a = $query_data [answer]; echo TR\n; echo TD WIDTH=\5%\ ALIGN=\CENTER\$id/TD\n; echo TD WIDTH=\70%\ ALIGN=\CENTER\$q/TD\n; echo TD WIDTH=\15%\ ALIGN=\CENTER\input type=\text\ name=\textfield\ value=$a/TD\n; echo TD WIDTH=\10%\ ALIGN=\CENTER\ form name=\update\ method=\post\ action=\$PHP_SELF?action=changeid=$idq=input\ input type=\submit\ name=\input\ value=\Update\ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing text info using $PHP_SELF
Rather than using forms to pass information to a script you should consider using sessions instead. In any case if you are going to use forms instead of appending the information to the form action use the input type=hidden field. input type=hidden name=action value=change This keeps your form action clean and it also allows you to cleanly use POST instead of GET. Jason On Sun, 2002-12-15 at 12:23, Lightfirst wrote: I am using PHP and MySql and wanted to know if it possible to pass the value inserted in a text box back to the page using PHP_SELF. Bellow is the snipped of code. The part that is not working is q=input. Any ideas? Thanks. while($query_data = mysql_fetch_array($result)) { $id = $query_data [q_id]; $q = $query_data [question]; $a = $query_data [answer]; echo TR\n; echo TD WIDTH=\5%\ ALIGN=\CENTER\$id/TD\n; echo TD WIDTH=\70%\ ALIGN=\CENTER\$q/TD\n; echo TD WIDTH=\15%\ ALIGN=\CENTER\input type=\text\ name=\textfield\ value=$a/TD\n; echo TD WIDTH=\10%\ ALIGN=\CENTER\ form name=\update\ method=\post\ action=\$PHP_SELF?action=changeid=$idq=input\ input type=\submit\ name=\input\ value=\Update\ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing text info using $PHP_SELF
At 20:23 15.12.2002, Lightfirst said: [snip] I am using PHP and MySql and wanted to know if it possible to pass the value inserted in a text box back to the page using PHP_SELF. Bellow is the snipped of code. The part that is not working is q=input. Any ideas? form name=\update\ method=\post\ action=\$PHP_SELF?action=changeid=$idq=input\ [snip] Most certainly register_globals is off in your php.ini file. Try using $_SERVER['PHP_SELF'] instead of $PHP_SELF. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php