I have a form page and another page that does the action of the form page. Right now, my echo statements are always showing up top, and I do not want that. I want to be able to put the echo in a desired spot.
My code from the form (join_form.html) page:
<form name="form1" method="post" action="register.php">
///Form data: firstname, lastname, etc////////////////
</form>
My code form the php page:
<?
if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){
echo 'You did not submit the following required information! <br />';
if(!$first_name){
echo "First Name is a required field. Please enter it below.<br />";
}
if(!$last_name){
echo "Last Name is a required field. Please enter it below.<br />";
}
if(!$email_address){
echo "Email Address is a required field. Please enter it below.<br />";
}
if(!$username){
echo "Desired Username is a required field. Please enter it below.<br />";
}
include 'join_form.html'; // Show the form again!
/ End the error checking and if everything is ok, we'll move on to
creating the user account /
exit(); // if the error checking has failed, we'll exit the script!
}
all of my echos are showing on top....I want them to appear near the form itself...stating the error (echo) and showing the form underneath it. As of right now...my echos are on top while my form is in the middle of my page.
What I mean by "my echos are on top" I meant, it's showing above my navigations, logo, etc.
should I have both .html (join_form) and php (register.php) migrate to one single .php form and have the action (register.php) be rename to <?=$PHP_SELF?>
<form action="<?=$PHP_SELF?>" method="post">