
07-07-2006, 16:27
|
|
|
|
חבר מתאריך: 16.10.04
הודעות: 34
|
|
|
מה לא טוב בקוד הבא? (הכנסת נתונים לMySQL)
הנה החלקים ה"חשובים" של הדף
קוד:
<?
$showmail = htmlspecialchars($_POST["showmail"]);
$showmail = stripslashes($_POST["showmail"]);
$showmail = mysql_real_escape_string($showmail);
$showicq = htmlspecialchars($_POST["showicq"]);
$showicq = stripslashes($_POST["showicq"]);
$showicq = mysql_real_escape_string($showicq);
?>
זו השאילתא:
קוד:
UPDATE `users` SET `age` = '$age',`fav` = '$fav',`password` = '$password',`mail` = '$mail',`icq` = '$icq',`showmail` = '$showmail',`showicq` = '$showicq' where ID=".$_COOKIE["ID"].""
ויש שני checkbox , שנקבעים לפי הrow של אותו חלק:
קוד:
<?
if($row['showicq'] == 1){
echo "<input id=\"icq2\" checked type=\"checkbox\" name='showicq' value=\"1\">";
}else{
echo "<input id=\"icq\" type=\"checkbox\" name='showicq' value=\"0\">";
}
?>
(הבאתי רק אחד כי שניהם נראים אותו דבר)
הבעיה היא שאני יכול לשנות את הpassword mail age וכו', וזה מתעלם לי מהvalue של ה- checkbox
|