Jump to content

Recommended Posts

I need to pull in specific data under if/else statement in another file.

 

The data is pulled via AJAX to create a dynamic form, but I'm also trying to pull the same data to create a static form for people without javascript enabled. So they would click a link and reload the entire page instead of a radio button and AJAX. The AJAX is trigger via signup.php?ajax&signup_type=$form_type.

 

Right now the else statement is triggering and I am getting the base form to display. But if I add ?signup_type=music to the URL, nothing shows up other than the elements that are already hard coded into the primary page.

 

Be sure to turn Javascript off:

http://beta.area51entertainment.co/signup

 

Here's what I'm trying to do:

 

	<noscript>';
	if($_GET['signup_type']=="music"){
	$form_type="music";
	$content.= include 'signup.php';
	}
	else{
	$content.= include 'signup.php';
	}
	$content.='	</noscript>

 

 

Here's signup.php

<?php
if($form_type=="music"){
$content2.='Test';
}
elseif($form_type=="film"){
$content2.='Test2';
}
elseif($form_type=="business"){
$content2.='Test3';
}
elseif($form_type=="other"){
$content2.='Test4 G';
}
else{
$year_menu=generateBirthYearMenu(date("Y"));
$day_menu=generateBirthDayMenu(null,null);
$content2.='<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>';
}

if(isset($_GET['ajax'])){
echo $content2;
}

return $content2;
?>

 

 

I tried using a full URL with the query string directly in an include, and my webhost has that kind of include turned off.

Using this:

 

if($_GET['signup_type']=="music"){
	$_GET['form_type']="music";
	$content.= include 'signup.php';
	}

 

does work.

 

I was just trying to use the wrong URL. I was using signup?signup_type=$form_type should have been  signup/?signup_type=$form_type. Forgot the slash.

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.