gamerzfuse Posted April 28, 2009 Share Posted April 28, 2009 I am following an old PHP tutorial from 2003. They advised to use the following string for my Form Action: <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> Now when i hit submit on the form it simply comes up with a Page Not Found Error as it tries to access the url: http://www.example.com/<?=$_SERVER['PHP_SELF']?> Is there a new way to do this? Could I simply make the action say <form method="post" action="signup.php"> ? Thanks in advance! EDIT: Additional Information (Original instructions) Notice the action attribute. In a familiar design pattern, which I have called multipurpose pages in previous articles, we are causing the form to be submitted to the same page containing the form code. By watching for the PHP variable $_POST['submitok'], which will be created by the submit button in this form (notice name="submitok" in the tag), our script will be able to handle the form submissions as well as the display of the form itself. We're also using a relatively new form of syntax to print out the $_SERVER['PHP_SELF'] variable. In case you are unfamiliar with this syntax, allow me to clarify that <?=expression?> is functionally identical to <?php echo expression; ?>. Thus, in this case, we could have instead written the following: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted April 28, 2009 Share Posted April 28, 2009 welcome to 2009! working with form actions is an HTML issue .. but yes, you can put in a file as the action. you're pointing the action to whatever script/file is going to be processing the form. <?=$_SERVER['PHP_SELF']?> is just reloading the page and should be <?php echo $_SERVER['PHP_SELF']; ?> instead. Quote Link to comment Share on other sites More sharing options...
gamerzfuse Posted April 28, 2009 Author Share Posted April 28, 2009 welcome to 2009! working with form actions is an HTML issue .. but yes, you can put in a file as the action. you're pointing the action to whatever script/file is going to be processing the form. <?=$_SERVER['PHP_SELF']?> is just reloading the page and should be <?php echo $_SERVER['PHP_SELF']; ?> instead. Unfortunately this gives me the exact same error with your code in the URL instead of the original code. I understand that this may start as an HTML issue, but it is based around PHP and these are the best forums I have found for quick and accurate results. EDIT: Pointing to signup.php and a minor code change in that file made it all work. Now I'm just getting a Database Down error because I don't have my database parameters set up properly. Need to find database name, figure out if user has a prefix (ie: gamerzfu_user or just user) and get my password. SOLVED: Used username with the prefix for database name AND username from my bluehost account. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.