[英]getting session info after submitting a form
在下面的代碼中,它無法檢索任何結果,當我對member_username ='admin'進行硬編碼時,它可以正常工作,但是當我對member_username ='$ kdo'進行編碼時,它將失敗。 即使當我回顯$ kdo時,它也會顯示“ admin”(不帶引號)
<?php
mysql_set_charset('utf8');
$result = mysql_query("SELECT * FROM members WHERE member_username = '$kdo'");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "
<fieldset>
<legend>Změnit kontaktní informace</legend>
<form method='post' action='zucet.php' class='menu_add'>
<p>
Email: <input type='text' name='aemail' id='aemail' value='$row[4]' size='30'/><br>
Jméno: <input type='text' name='ajmeno' value='$row[8]' size='30'/><br>
Příjmení: <input type='text' name='aprijmeni' value='$row[9]' size='30'/><br>
Firma: <input type='text' name='afirma' value='$row[15]' size='30'/><br>
Telefon: <input type='text' name='atel' value='$row[10]' size='30'/><br>
Centrální tel.: <input type='text' name='actel' value='$row[11]' size='30'/><br>
Město: <input type='text' name='amesto' value='$row[12]' size='30'/><br>
Ulice: <input type='text' name='aulice' value='$row[13]' size='30'/><br>
Čas doručení: <input type='text' name='acas' value='$row[14]' size='30'/><br>
<input type='submit' name='zmenit' formaction='zucet.php' value='Změnit' />
</p>
</form>
</fieldset>";
}
mysql_free_result($result);
?>
zucet.php
<?php
session_start();
$con = mysql_connect("juxcore.ipagemysql.com", "*", "*") or
die("Could not connect: " . mysql_error());
mysql_select_db("jux_mms");
mysql_set_charset('utf8');
$sql="UPDATE members SET member_email = '$_POST[aemail]' WHERE member_username = '$kdo'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('Location: http://www.juxcore.com/x/vita/ucet.php');
mysql_close($con);
感謝您的幫助,非常感謝
嘗試這個:
$result = mysql_query("SELECT * FROM members WHERE member_username = '" . $kdo . "';");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.