ani_anirban Posted March 23, 2007 Share Posted March 23, 2007 //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.. Link to comment https://forums.phpfreaks.com/topic/43937-transmit-form-variables-from-one-page-to-another/ Share on other sites More sharing options...
DeathStar Posted March 23, 2007 Share Posted March 23, 2007 Please use next time! Why not use sessions? Or method='post' ?? Link to comment https://forums.phpfreaks.com/topic/43937-transmit-form-variables-from-one-page-to-another/#findComment-213346 Share on other sites More sharing options...
ukferret Posted March 23, 2007 Share Posted March 23, 2007 I am I right in saying that if you use sessions which are created from forms you will need Register_Globals turned on!! most shared hosting providers have this turned off for security. Link to comment https://forums.phpfreaks.com/topic/43937-transmit-form-variables-from-one-page-to-another/#findComment-213404 Share on other sites More sharing options...
kenrbnsn Posted March 23, 2007 Share Posted March 23, 2007 No, sessions are fine with register_globals turned off. Just put "session_start()" at the start of your script and explicitly store or retrieve values from the $_SESSION array. Ken Link to comment https://forums.phpfreaks.com/topic/43937-transmit-form-variables-from-one-page-to-another/#findComment-213408 Share on other sites More sharing options...
ani_anirban Posted March 23, 2007 Author Share Posted March 23, 2007 thanx to all of u dudes..thanx for ur so valuable inputs,.. Link to comment https://forums.phpfreaks.com/topic/43937-transmit-form-variables-from-one-page-to-another/#findComment-213816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.