Jump to content

Issue with PHP Form Submit


advancedfuture

Recommended Posts

I am trying to execute some PHP code, I've done this before on my godaddy hosting account, but for some reason the code isn't working now that I ported it over to my private server.

 

It WORKS if i put the PHP on a seperate page and send the info through action=... but the if statement is not working if i try to execute the code on the same page ):

 

Here's the stripped down version of the code....

 

<form name="signup" id="signup" method="post" action="">
   <div align="center">
     First Name:
     <input type="text" name="first_name" id="first_name" />
     <input type="submit" id="dosubmit" name="dosubmit" value="Sign Up!" />
   </div>
</form>

<?php
if(isset($_POST['dosubmit']))	
{
echo "CHEESE!";
}
?>

 

am I doing something wrong? The code just isnt executing...

Link to comment
https://forums.phpfreaks.com/topic/139295-issue-with-php-form-submit/
Share on other sites

<?php
if(isset($_POST['dosubmit'])){
   echo "CHEESE!";
}
?>

<form name="signup" id="signup" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <div align="center">
     First Name:
     <input type="text" name="first_name" id="first_name" />
     <input type="submit" id="dosubmit" name="dosubmit" value="Sign Up!" />
   </div>
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.