Jump to content

Get variable


gish

Recommended Posts

I am trying to create a tally by using the get function this is the code so far

 

page one

						<?php	
						   if ($_GET['t'] == ''){
							 	  $_GET['t'] = 0;				
							}

							if ($_GET['q'] == 1){
								$answer = "While she is tried.";
							} else if  ($_GET['q'] == 2){
								$_GET['t'] = $_GET['t']+1;
								$tally = $_GET['t'];
								$answer = "While she is tried.";
							} else if ($_GET['q'] == 3){
								$answer = "While she is tried.";
							}else {
						   	echo '<a href="QuestionOne.php" name="question_one">
						   	        Oops you did not select an answer please try again</a>';

							}	
						?>

 

<a href="QuestionTwo.php?t=<?php echo $tally;?>" name="question_two">Question Two</a>

 

This works fine when I send it to QuestionTwo.php i will get 0 or a 1 in the url bar

Then I have to ask a question. When the form submits to The next page it does not take the t variable with it.

 

How do I do this?

Link to comment
https://forums.phpfreaks.com/topic/153454-get-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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