<h4>Customer Service - Contact Us</h4>
<h5>Send us a message</h5><br>
<?php
echo "<p><label>Name</label></p>";
echo '<p><input type="text" style="height: 25px;" class="span4" name="name" id="orderID"></p>';
echo "<p><label>Email Address</label></p>";
echo '<p><input type="text" style="height: 25px;" class="span4" name="email" id="email"></p>';
echo "<p><label>Message:</label></p>";
echo '<p><textarea rows="5" name="comment"></textarea></p>';
echo '<br><button type="submit" class="btn">Submit</button>';
session_start();
$qry = "select * from users where email='$_SESSION[email]'";
$result = @mysql_query($qry);
while ($row=mysql_fetch_array($result)){
if($_SESSION['isCustomer'==true){
echo "<p><label>Name</label></p>";
echo '<p><input type="text" style="height: 25px;" class="span4" name="name" id="orderID" value='.$row['first_name'].'></p>';
echo "<p><label>Email Address</label></p>";
echo '<p><input type="text" style="height: 25px;" class="span4" name="email" id="email" value='.$row['email'].'></p>';
echo "<p><label>Message:</label></p>";
echo '<p><textarea rows="5" name="comment"></textarea></p>';
echo '<br><button type="submit" class="btn">Submit</button>';
}}?>
你好,我有这个问题,当登录和会话。它必须显示存储的帐户的值,这是我知道该怎么做。但我需要知道的是如何使用的条件,如果没有一个记录或有记录的帐户。如果登录时有值,如果没有登录,则表格为空
例如,我登录。
压接我们时,值已经在那了。
当我没有登录。
联系我们将是空白。
我该怎么做?谢谢。
这里是我的checklogin.php。它工作我不知道isCustomer部分,但它的工作原理。
while($row = mysql_fetch_array($result)){
//remove this line ******header("location:customer.index.php");
if($row['type'] == 'admin'){
$_SESSION['isAdmin'] = true;
header("location: admin/admin.php");
} else if($row['type'] == 'customer'){
$_SESSION['isCustomer'] = true;
header("location: ../customer.index.php")
; }
}
}
如果我记录它它说SESSION已经开始。 – 2014-09-28 08:30:07
@VinceAgno那么你可以在我的回答中删除'session_start()',因为它也已经启动 – Ghost 2014-09-28 08:36:28