Jump to content

URL Question


ballhogjoni

Recommended Posts

Maybe I am not asking it right. I want to auto redirect to page 2, page 3, and so on depending on what page they are on. So if they are on page 2 and they click submit, I want it to go to page 3 automatically, but the form action="" tag has to go to the same page they submitted from because thats where all my php script is.

Link to comment
https://forums.phpfreaks.com/topic/48952-url-question/#findComment-239837
Share on other sites

Ok this is what i have:

<?php
define("DEFAULT_REDIRECT", "\"".$_SERVER['PHP_SELF']."?page=$i\""); // $i is defined ealier in the script
function redirect($filename=DEFAULT_REDIRECT, $delay="0", $die="0") {
if((!headers_sent())&&($delay=="0")) {
	header("Location:$filename");
} elseif($delay=="0"){
	echo "<script type=\"text/javascript\">";
	echo "window.location.href=\"".$_SERVER['PHP_SELF']."?page=$i\"";
	echo "</script>";
	echo "<noscript>";
	echo "<meta http-equiv=\"refresh\" content=\".0;url=".$filename."\">";
	echo "<noscript>";
	} else {
		echo "<meta http-equiv=\"refresh\" content=\"".$delay.";url=".$filename."\">";
		}
	}

if (isset($too_small)) {
$sql = mysql_query("SELECT * FROM contact_n_questions LIMIT $from, $max_results");
	while($row = mysql_fetch_array($sql)){
		if (isset($row['fname'])) {
			mysql_query("INSERT INTO dispo_tooSmall (fname, lname, position, email, state, areacode, prefix, linenumber, question1, question2, question2q1, question2q2, question2q3, question2q4, question2q5, question2q6, question3, question4q1, question4q2, question4q3, question4q4, question4q5, question5q1, question5q2, question5q3, question5q4, question5q5, question5q6, question6, question7, question8, question9, tandc, comments) VALUES ('$row[fname]','$row[lname]','$row[position]','$row[email]','$row[state]','$row[areacode]','$row[prefix]','$row[linenumber]','$row[question1]','$row[question2]','$row[question2q1]','$row[question2q2]','$row[question2q3]','$row[question2q4]','$row[question2q5]','$row[question2q6]','$row[question3]','$row[question4q1]','$row[question4q2]','$row[question4q3]','$row[question4q4]','$row[question4q5]','$row[question5q1]','$row[question5q2]','$row[question5q3]','$row[question5q4]','$row[question5q5]','$row[question5q6]','$row[question6]','$row[question7]','$row[question8]','$row[question9]','$row[tandc]','$comments')");
			//mysql_query("DELETE FROM contact_n_questions WHERE email='$row[email]'");
			redirect("\"".$_SERVER['PHP_SELF']."?page=$i\"");
		} elseif (!isset($row['fname'])) {
			echo "<p align=\"center\">Don't Forget To Disposition the Lead.</p>";
		} else { 
			echo "<p align=\"center\"><font color=\"red\"><b>What the crap, an error! Go talk to Chris</b></font></p>";
		}
	}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/48952-url-question/#findComment-239868
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.