Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

php redirect based on value not working?

$
0
0

Hello, i have a signup page, a login page, failed.php and a landing page once they have signed up.

 

the user signs up (application-formP1.php) then once they have done this they are redirected to the next page (application-formP2.php) they then have other information to add.

 

on application-formP1.php there is a redirect that if the user has finished with the page (completed it) they are directed to application-formP2.php

 

if($status == "P1complete")

{

          header("location: application-formP2.php");

}

 

 

the trouble i am having is if i just try to access application-formP1.php ( which is the signup page) it is automatically sending the user to application-formP2.php even if they are not signed in then because they are not signed in it is sending the user to the failed page (obiously because the retstrict user is working)

 

i have included the code below for application-formP1.php

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

  $insertSQL = sprintf("INSERT INTO LettingsTenApp (tenID, progress, tenTitle, tenUsername, tenPassword, tenSex, tenEmail, tenDobDD, tenDobMM, tenDobYY, tenDepend, tenMarital, tenPrevSurn, tenEmployTyp, tenNINumber) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

                       GetSQLValueString($_POST['tenID'], "int"),

                                                     GetSQLValueString($_POST['progress'], "text"),

                       GetSQLValueString($_POST['tenTitle'], "text"),

                       GetSQLValueString($_POST['tenUsername'], "text"),

                       GetSQLValueString($_POST['tenPassword'], "text"),

                       GetSQLValueString($_POST['tenSex'], "text"),

                       GetSQLValueString($_POST['tenEmail'], "text"),

                       GetSQLValueString($_POST['tenDobDD'], "text"),

                       GetSQLValueString($_POST['tenDobMM'], "text"),

                       GetSQLValueString($_POST['tenDobYY'], "text"),

                       GetSQLValueString($_POST['tenDepend'], "text"),

                       GetSQLValueString($_POST['tenMarital'], "text"),

                       GetSQLValueString($_POST['tenPrevSurn'], "text"),

                       GetSQLValueString($_POST['tenEmployTyp'], "text"),

                       GetSQLValueString($_POST['tenNINumber'], "text"));

 

 

  mysql_select_db($database_Letting, $Letting);

  $Result1 = mysql_query($insertSQL, $Letting) or die(mysql_error());

 

 

  $insertGoTo = "application-formP2.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

 

mysql_select_db($database_Letting, $Letting);

$query_rsTenant = "SELECT * FROM LettingsTenApp";

$rsTenant = mysql_query($query_rsTenant, $Letting) or die(mysql_error());

$row_rsTenant = mysql_fetch_assoc($rsTenant);

$totalRows_rsTenant = mysql_num_rows($rsTenant);

 

 

$status = $row_rsTenant['progress'];

 

 

// Redirect user if thier application is completed

if($status == "P1complete")

{

          header("location: application-formP2.php");

}

 

 

and the form

 

<form action="<?php echo $editFormAction; ?>" method="post" name="form1" >

        <input type="submit" value="Save &amp; continue" />

        <input type="hidden" name="progress" value="P1complete" />

        <input type="hidden" name="MM_insert" value="form1" />

</form>

 

 

thanks


Viewing all articles
Browse latest Browse all 238792

Trending Articles