Jump to content

Form not trigger right if statement on submit


Recommended Posts

I don't know if this is a PHP issue or a HTML form issue, but thought I'd post here:

 

 

When I click the submit button my form, it sends the data to the right page, but it loads the else in the if/else statement.

 

<?php
require_once 'function.php';
$form_type=$_GET['signup_type'];

$register_user=$_SESSION['register_user'];
$newuser=$_POST['newuser'];
if($register_user=="add" && $newuser=="add"){
$register_account_type=$_POST['register_account_type'];
$register_email=$_POST['register_email'];
$register_fname=$_POST['register_fname'];
$register_lname=$_POST['register_lname'];
$register_check_email=$_POST['register_check_email'];
$register_password=$_POST['register_password'];
$register_check_password=$_POST['register_check_password'];
$register_gender=$_POST['register_gender'];
$register_month=$_POST['register_month'];
$register_day=$_POST['register_day'];
$register_year=$_POST['register_year'];
$register_membership_type=$_POST['register_membership_type'];
$register_bot=$_POST['register_bot'];
$register_submit_button=$_POST['register_submit_button'];

echo "
Register Account Type: $register_account_type <br />
Register Email: $register_email <br />
Register First Name: $register_fname <br />
Register Last Name: $register_lname <br />
Register Check Email: $register_check_email <br />
Register Password: $register_password <br />
Register Password Check: $register_check_password <br />
Register Gender: $register_gender <br />
Register Birthday: $register_month / $register_day / $register_year <br />
Register Bot: $register_bot <br />
Register Submit: $register_submit_button
";
}

if($form_type=="music"){
$content.='Test';
}
elseif($form_type=="film"){
$content.='Test2';
}
elseif($form_type=="business"){
$content.='Test3';
}
elseif($form_type=="other"){
$content.='Test4 &#71;';
}
else{
//other data
}
echo $content;
echo $_SESSION['register_user'];
echo $newuser;
?>

 

Here's the form page:

 

elseif(isset($_GET['signup'])){
session_start();
$_SESSION['register_user']="add";
$year_menu=generateBirthYearMenu(date("Y"));
$day_menu=generateBirthDayMenu(null,null);
$switch="notloggedin";
$content.='<div class="register_ad_wrapper">
<div class="register_wrapper">
	<form name="sign_up_type" action="./signup.php" method="post">
	<input type="hidden" name="newuser" id="newuser" value="add" />
		<div class="register_account_type_position">
		<p class="signup_title">Sign-Up for - Step One</p>
		<p class="register_account_type_title">Account Type:</p>
		<span class="register_account_type_personal_position"><input type="radio" value="personal" name="register_account_type" id="register_account_type_personal" class="register_account_type_personal" onclick="sendReq(\'personal\');" '; if((isset($_SESSION['account_type']) && $_SESSION['account_type']=="personal") || !isset($_SESSION['account_type'])){ $content.='checked="checked" '; } $content.='/> <label for="register_account_type_personal"><span class="register_radio_text">Personal</span></label></span>
		<span class="register_account_type_music_position"><input type="radio" value="music" name="register_account_type" id="register_account_type_music" class="register_account_type_music" onclick="sendReq(\'music\');" '; if(isset($_SESSION['account_type']) && $_SESSION['account_type']=="music"){ $content.='checked="checked" '; } $content.='/> <label for="register_account_type_music"><span class="register_radio_text">Band/Recording Artist</span></label></span>
		<span class="register_account_type_film_position"><input type="radio" value="film" name="register_account_type" id="register_account_type_film" class="register_account_type_film" onclick="sendReq(\'film\');" '; if(isset($_SESSION['account_type']) && $_SESSION['account_type']=="film"){ $content.='checked="checked" '; } $content.='/> <label for="register_account_type_film"><span class="register_radio_text">Filmmaker/Actor</span></label></span>
		<span class="register_account_type_business_position"><input type="radio" value="business" name="register_account_type" id="register_account_type_business" class="register_account_type_business" onclick="sendReq(\'business\');" '; if(isset($_SESSION['account_type']) && $_SESSION['account_type']=="business"){ $content.='checked="checked" '; } $content.='/> <label for="register_account_type_business"><span class="register_radio_text">Business</span></label></span>
		<span class="register_account_type_other_position"><input type="radio" value="business" name="register_account_type" id="register_account_type_other" class="register_account_type_other" onclick="sendReq(\'other\');" '; if(isset($_SESSION['account_type']) && $_SESSION['account_type']=="other"){ $content.='checked="checked" '; } $content.='/> <label for="register_account_type_other"><span class="register_radio_text">Other</span></label></span>
		</div>
	<div id="signup_forms">
		<div class="register_form_wrapper">
		<p class="register_form_position">
		<label for="register_email"><span class="register_form_text">Email:</span></label> <input type="email" value="'.$_SESSION['register_email'].'" name="register_email" id="register_email" class="register_form" />
		</p>
		<p class="register_form_position">
		<label for="register_fname"><span class="register_form_text">First Name:</span></label> <input type="text" value="'.$_SESSION['register_fname'].'" name="register_fname" id="register_fname" class="register_form" />
		</p>
		<p class="register_form_position">
		<label for="register_lname"><span class="register_form_text">Last Name:</span></label> <input type="text" value="'.$_SESSION['register_lname'].'" name="register_lname" id="register_lname" class="register_form" />
		</p>
		<p class="register_form_position">
		<label for="register_check_email"><span class="register_form_text">Re-enter Email:</span></label> <input type="email" value="'.$_SESSION['register_check_email'].'" name="register_check_email" id="register_check_email" class="register_form" />
		</p>
		<p class="register_form_position">
		<label for="register_password"><span class="register_form_text">New Password:</span></label> <input type="password" value="'.$_SESSION['register_password'].'" name="register_password" id="register_password" class="register_form" />
		</p>
		<p class="register_form_position">
		<label for="register_check_password"><span class="register_form_text">Re-enter Password:</span></label> <input type="password" value="'.$_SESSION['register_check_password'].'" name="register_check_password" id="register_check_password" class="register_form" />
		</p>
		<p class="register_form_position_gender">
		<label for="register_gender">Gender:</label>
		<select name="register_gender" id="register_gender">
		<option value=""></option>
		<option value="Female">Female</option>
		<option value="Male">Male</option>
		</select>
		</p>
		<p class="register_form_position_birthday">
		Birthday:
		<select name="register_month" id="register_month" onchange="sndReq(register_year.value,this.value);">
		<option value="">Month</option>
		<option value="January">January</option>
		<option value="February">February</option>
		<option value="March">March</option>
		<option value="April">April</option>
		<option value="June">June</option>
		<option value="July">July</option>
		<option value="August">August</option>
		<option value="September">September</option>
		<option value="October">October</option>
		<option value="November">November</option>
		<option value="December">December</option>
		</select>
		<select name="register_day" id="register_day">
		<option>Day</option>'."\n".
		$day_menu
		.'</select>
		<select name="register_year" id="register_year" onchange="sndReq(this.value,register_month.value);">
		<option>Year</option>'."\n".
		$year_menu
		.'</select>
		</p>
		</div>
	</div>
			<div class="register_membership_type_position">
			<span class="register_membership_type_title">Membership Type:</span>
			<span class="register_membership_type_basic_position"><input type="radio" value="basic" name="register_membership_type" id="register_membership_type_basic" class="register_membership_type_basic" onchange="changeButton(\'basic\');" '; if((isset($_SESSION['membership_type']) && $_SESSION['membership_type']=="basic") || !isset($_SESSION['membership_type'])){ $content.='checked="checked" '; } $content.='/> <label for="register_membership_type_basic"><span class="register_radio_text">Basic</span></label></span>
			<span class="register_membership_type_premium_position"><input type="radio" value="premium" name="register_membership_type" id="register_membership_type_premium" class="register_membership_type_premium" onchange="changeButton(\'premium\');" '; if(isset($_SESSION['membership_type']) && $_SESSION['membership_type']=="premium"){ $content.='checked="checked" '; } $content.='/> <label for="register_membership_type_premium"><span class="register_radio_text">Premium</span></label></span>
			<span class="register_membership_type_platinum_position"><input type="radio" value="platinum" name="register_membership_type" id="register_membership_type_platinum" class="register_membership_type_platinum" onchange="changeButton(\'platinum\');" '; if(isset($_SESSION['membership_type']) && $_SESSION['membership_type']=="platinum"){ $content.='checked="checked" '; } $content.='/> <label for="register_membership_type_platinum"><span class="register_radio_text">Platinum</span></label></span>
			<span class="learn_more_position">(<a href="/signup?memberships">Learn More About Membership Types</a>)</span>
			</div>
		<div class="form_question_wrapper">
		<p class="register_form_question_title">Random Question (&#66;&#111;&#116; Screener):</p>
		<p class="register_form_question_position">
		<label for="register_bot"><span class="register_form_question_text">What is the primary color of this page (starts with "&#71;"):</span></label> 
		<input type="text" value="'.$_SESSION['register_bot'].'" name="register_bot" id="register_bot" class="register_question_form" />
		</p>
		</div>
		<p class="signup_agreement">
		By clicking the sign-up button below you are agreeing to our Terms of Services and our Privacy Policy.
		</p>
		<p class="register_form_position register_submission">
		<input type="submit" value="Sign Up" class="register_button_position" id="register_submit_button" name="register_submit_button" />
		</p>
	</form>
</div>
<div class="ad_wrapper">
Ad
</div>
</div>
';
}

 

$_SESSION['register_user']; and $_POST['newuser']; are both set, as I can see the values echoed out when the page loads. When I try echoing out $register_user the value is not displayed. So some how passing the session variable data to the $register_user variable is not working.

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.