Re: Unable to pass values throug form

From: Date: Sat, 06 Dec 2003 06:37:55 +0000
Subject: Re: Unable to pass values throug form
Groups: php.install 
Request: Send a blank email to php-install+get-12337@lists.php.net to get a copy of this message
Dear Perdeep Singh I saw your code, some mistakes been found and I corrected it as follows. In <Form method=post action="put the same file name"> dont put http:\\localhost\test.php in action attribute of the form tag. Just type the file name where the following code appears. Example the following code I put in a file and named it as 'singh.php'. And the same is specified in action attribute also. Important Note: You have to edit php.ini for register_globals=on. It will be off you have to type on. Search for register_globals in php.ini file and make it on. Then only $HTTP_POST_VAR works out. And in for each loop spelling mistake occured NOT $HTTP_POST_VAR you have to add 'S' as follows $HTTP_POST_VARS. Best of Luck <html> <head> </head> <body> <?php global $call,$HTTP_POST_VAR; echo"Call is $call"; switch($call) { case"":show(); break; case"show2": foreach($HTTP_POST_VARS as $key=>$val) { echo"<br>$key := $val"; } show2(); break; } function show() { echo"<form name='frm' method='post' action='singh.php'>"; echo"<input type='hidden' name='call' value='show2'>"; echo"<input type='submit' name='submit' value='submit'>"; echo"</form>"; } function show2() { echo"<BR>here in show2 function"; exit; } ?> <BR><BR><BR><BR><BR> _______________________________ ---------- Original Message ---------------------------------- From: "Perdeep Singh" <per_deep_singh@hotmail.com> Date: Fri, 6 Dec 2002 06:00:24 +0530 Sir, i installed php 4.3.3 on windows xp having iis 5.1 it's great working except that it not able to take value through form .As shown in below code show() function called easily but when v click on button it dosn't take value of hidden field name call and hence unable to call function show2(). Sir i'll b very much thankful to u if u solve my this problem. Waiting 4 u r mail. Perdeep Singh (India) <html> <head> </head> <body> <?php global $call,$HTTP_POST_VAR; echo"Call is $call"; switch($call) { case"": show(); break; case"show2": foreach($HTTP_POST_VAR as $key=>$val) { echo"<br>$key := $val"; } show2(); break; } function show() { echo"<form name='frm' method='post' action='http://localhost/test.php'>"; echo"<input type='hidden' name='call' value='show2'>"; echo"<input type='submit' name='submit' value='submit'>"; echo"</form>"; } function show2() { echo"here in show2 function"; exit; } ?> </body> </html>

« previous php.install (#12337) next »