1. After signup.php i have a userAgreement.php(2nd file) file that is linked with creaditCardInfo.php(3rd file) file. In the end, I have createAccount.php file.
2. I need help. I know i can store form values in $\_session but its not working.
3. Can you please help me to figure out where is the mistake?
4. below are my 4 files.userAgreement.php(第2页)
<?php include 'preCode.php'; include 'header.php'; echo '<body><div class="standardLayout">'; include 'systemMenu.php'; $\_SESSION['email'] = secure\_input($\_POST['email']); $\_SESSION['fName'] = secure\_input($\_POST['fName']); ?>creditCardInfo.php(第3页)
<?php include 'preCode.php'; include 'header.php'; echo '<body><div class="standardLayout">'; include 'systemMenu.php'; $\_SESSION['email'] = secure\_input($\_POST['email']); $\_SESSION['fName'] = secure\_input($\_POST['fName']); ?>createAccount.php(第4页)
<?php include 'preCode.php'; include 'header.php'; echo '<div class="standardLayout">'; include 'systemMenu.php'; $\_SESSION['fName'] = secure\_input($\_POST['fName']); $\_SESSION['email'] = secure\_input($\_POST['email']); $email = $\_SESSION['email']; echo $email; $\_SESSION['fromLogin'] = false; $user = new user(); $user->fName = secure\_input($\_POST['fName']); $user->email = secure\_input($\_POST['email']); $query = "INSERT INTO Users (fName, email)VALUES ('" . $user->fName . "', '" . $user->email . "'); echo '<h2>User Information</h2> <div class="left"> <form method="post" action="editUser.php"> // I want to display session values here in this form. But its not printing anything except the field names(Name and email). <i>Name:</i> '$user->fName . '<br> <i>Address:</i> '$user->address .'<br> <input type="submit" value="Edit Information"></form>';
发布于 2015-07-26 07:46:39
最后一页( createAccount.php )似乎是问题所在。您根据表单提交为会话vars分配值,但从代码判断,该页面没有表单提交。与其错误地分配这些vars,不如简单地使用存储的会话变量,而不使用有效的null值重新分配。事实上,在第3页上也是如此--似乎没有一个表单可以发布到第3页,所以您再次用空值覆盖会话vars。当然,在包含的文件中可能有一个表单,但是如果是这样的话,为什么还有另一对字段“email”和“fName”呢?
creditCardInfo.php(page 3)
--------------------------
<?php
include 'preCode.php';
include 'header.php';
echo '<body><div class="standardLayout">';
include 'systemMenu.php';
?>
createAccount.php(page 4)
-------------------------
<?php
include 'preCode.php';
include 'header.php';
echo '<div class="standardLayout">';
include 'systemMenu.php';
$email = $_SESSION['email'];
$_SESSION['fromLogin'] = false;
echo $email;
$user = new user();
$user->fName = $_SESSION['fName'];
$user->email = $_SESSION['email'];
$query = "INSERT INTO Users (fName, email)VALUES ('" . $user->fName . "', '" . $user->email . "');
echo '
<h2>User Information</h2>
<div class="left">
<form method="post" action="editUser.php">
<i>Name:</i> '.$user->fName . '<br>
<i>Address:</i> '.$user->address .'<br>
<input type="submit" value="Edit Information">
</form>';
?>https://stackoverflow.com/questions/31634671
复制相似问题