php 5.2 $submit action no working...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • miyagikarate
    New Member
    • Feb 2007
    • 2

    php 5.2 $submit action no working...

    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!!

    Code:
    <html>
    
    <body>
    
    <?php
    
    
    
    if ($submit) {
    
      // process form
    	echo 'ok';
      while (list($name, $value) = each($HTTP_POST_VARS)) {
    
        echo "$name = $value<br>\n";
    
      }
    
    } else{
    
      // display form
    
      ?>
    
      <form method="post" action="<?php echo $PHP_SELF?>">
    
      First name:<input type="Text" name="first"><br>
    
      Last name:<input type="Text" name="last"><br>
    
      Address:<input type="Text" name="address"><br>
    
      Position:<input type="Text" name="position"><br>
    
      <input type="Submit" name="submit" value="Enter information">
    
      </form>
    
      <?php
    
    
    
    } // end if
    
    
    
    ?>
    
    
    
    </body>
    thanks,

    alex
  • arizal
    New Member
    • Feb 2007
    • 25

    #2
    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

    Comment

    • miyagikarate
      New Member
      • Feb 2007
      • 2

      #3
      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

      Comment

      Working...