Jump to content

TRANSMIT form variables from one page to another


ani_anirban

Recommended Posts

//registration.php

 

<?php require_once('Connections/conn1.php'); ?>

<?php

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

 

$editFormAction = $_SERVER['PHP_SELF'];

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

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

$email=$_POST["Email-id"];

$pass1=$_POST["pass1"];

$pass2=$_POST["pass2"];

if($pass1==$pass2)

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

  $insertSQL = sprintf("INSERT INTO customer (id, name, email_id, password, address, city, `state`) VALUES (%s, %s, %s, %s, %s, %s, %s)",

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

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

                      GetSQLValueString($_POST['Email-id'], "text"),

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

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

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

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

 

  mysql_select_db($database_conn1, $conn1);

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

 

  $insertGoTo = "home.php";

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

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

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

  }

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

}}

else echo "password and confirmation password do not match";

 

mysql_select_db($database_conn1, $conn1);

$query_Recordset1 = "SELECT * FROM customer";

$Recordset1 = mysql_query($query_Recordset1, $conn1) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

ob_start();?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>registration</title>

</head>

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

<center> <font face="Times New Roman, Times, serif" size="+6">Registration</font>

  </center>

  <p>

      Name:<br>

  <input type="text" name="Name" id="textfield" />

</p>

  <p>

    Email-id:<br> <input type="text"  name="Email-id" id="label" />

  </p>

  <p>

    Password: <br>

    <input type="password" name="pass1" id="label2" />     

    (atleast 6 char)

  </p>

  <p>

    Confirm password:<br> <input type="password" name="pass2" id="label3" />

  </p>

  <p>

    <label for="label4">Address</label>

  </p>

  <p>

    <label for="textarea"></label>

    <textarea name="add" id="textarea"></textarea>

  </p>

  <p>

    <label for="label4">City<br />

    </label>

    <input type="text" name="city" id="label4" />

  </p>

  <p>

    <label for="label5">State<br />

    </label>

    <input type="text" name="state" id="label5" />

  </p>

  <p>

    <label for="Submit"><br />

    </label>

    <input type="submit" name="Submit" value="Submit" id="Submit" />

  </p>

  <p> </p>

 

  <p> </p>

 

 

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

</form>

</body>

</html>

<?php

mysql_free_result($Recordset1);

?>

 

this is my code and what i basically want to do is transmit the $email varibale to the welcome.php page.is that possible??please help..

 

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.