Jump to content

php form submit code not working


FirstBorn

Recommended Posts

Hi,

 

Thank you for reading.

 

I'm using the form submit code

Code:

 

<?php print $_SERVER["PHP_SELF"]; ?>

 

and it does not work for some reason...

 

Here is sample code for what I'm using:

 

<?php

if($_POST["submit"]) {

echo "Submit!";

} else {

?>
<html>
<head><title>Test Submit</title>
</head>
<body>
<form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post">
	<INPUT TYPE="submit" value="submit">
	<input type="reset" value="Reset">
</FORM>		
	<!-- form code ends here! -->
</body>
</html>
<?php } ?>

Why is this not working?

 

What I mean by 'not working' is that when

you press the button, it seems to reload the page

and doesn't seem to count the button click as a 'submit'

at all...

 

Any Ideas?

 

Thank you for your help!

 

Thanks,

FirstBorn

 

PS.  I've used two different webservers / hosts to test this out on,

and this script works on NEITHER of them.

(Dreamhost and HostGator Servers...)

Thanks.

Link to comment
Share on other sites

You need to give the submit button a name for it to be transmitted. BTW, if your script submits to itself, you don't need an action:

<form action="" method="post">
	<INPUT TYPE="submit" name="submit" value="submit">
	<input type="reset" value="Reset">
</FORM>

 

Ken

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.