By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

php 5.2 $submit action no working...

P: 2
On all of my webpage which require a submit action, the forms just reload as if nothing happened. I wrote a simple test code and I still can't get the form to work. I know they just stopped working within the last couple weeks since the update to php 5.2 Any help? Here is a sample test.. it doesn't work!!

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <body>
  4.  
  5. <?php
  6.  
  7.  
  8.  
  9. if ($submit) {
  10.  
  11.   // process form
  12.     echo 'ok';
  13.   while (list($name, $value) = each($HTTP_POST_VARS)) {
  14.  
  15.     echo "$name = $value<br>\n";
  16.  
  17.   }
  18.  
  19. } else{
  20.  
  21.   // display form
  22.  
  23.   ?>
  24.  
  25.   <form method="post" action="<?php echo $PHP_SELF?>">
  26.  
  27.   First name:<input type="Text" name="first"><br>
  28.  
  29.   Last name:<input type="Text" name="last"><br>
  30.  
  31.   Address:<input type="Text" name="address"><br>
  32.  
  33.   Position:<input type="Text" name="position"><br>
  34.  
  35.   <input type="Submit" name="submit" value="Enter information">
  36.  
  37.   </form>
  38.  
  39.   <?php
  40.  
  41.  
  42.  
  43. } // end if
  44.  
  45.  
  46.  
  47. ?>
  48.  
  49.  
  50.  
  51. </body>
thanks,

alex
Feb 27 '07 #1
Share this Question
Share on Google+
2 Replies


P: 25
Hi Miyagikarate,

I think what you need to do is replace ($submit) by
[PHP]

if ( $_POST['submit'] == "Enter information" ) {

......
}

[/PHP]

I am not sure but you can give it a try. Good Luck
Feb 27 '07 #2

P: 2
thanks. That worked...

I dont know why it used to work in a different version on Php but now that i made that change it works.

thanks again,

Alex
Feb 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.