<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