
26-09-2007, 09:55
|
|
|
|
חבר מתאריך: 21.01.06
הודעות: 813
|
|
אוקי זאת הבעיה,
עשיתי באותו עמוד, הוספת שירים ובחירתם..
עשיתי כך:
קוד PHP:
<html dir="rtl"> <center> <style type="text/css"> input, select { font-family: arial; font-size: 9pt; font-weight: bold; } </style> <head> <title>הוספת שירים</title> </head> <body> <br><br> <? require ("config.php"); // require connection to Mysql database $col = mysql_query ("SELECT * FROM colors"); $colors = mysql_fetch_array ($col); // the colors for design this paper ?> <form method="POST"> <table bgcolor="#00000"> <tr><td colspan="2"><b><font face="arial" size="2" color="White"> הוסף שיר חדש </b></font></tr></td> <tr><td bgcolor="<?=$colors['color'] ?>"><font face="arial" size="2">שם השיר</font></td><td bgcolor="<?=$colors['color'] ?>"><input type="text" name="sname" size="40"></td></tr> <tr><td bgcolor="<?=$colors['color'] ?>"><font face="arial" size="2">להקה</font></td><td bgcolor="<?=$colors['color'] ?>"><input type="text" name="sband" size="40"></td></tr> <tr><td bgcolor="<?=$colors['color'] ?>"><font face="arial" size="2">כתובת השיר</font></td><td bgcolor="<?=$colors['color'] ?>"><input type="text" name="slink" size="40"></td></tr> </table> <br><input type="submit" name="ssub" value="הוסף שיר חדש"> </form> <br><br> <? $sname = $_POST['sname']; $sband = $_POST['sband']; $slink = $_POST['slink']; if (isset ($_POST['ssub'])) { if ($sname == "") echo '<br><br><b><font face="arial" size="3" color="Red">לא נכתב שם השיר</font></b>'; // test if the name was`nt wrote. elseif ($sband == "") echo '<br><br><b><font face="arial" size="3" color="Red">לא נכתבה להקת השיר</font></b>'; // test if the band was`nt wrote. elseif ($slink == "") echo '<br><br><b><font face="arial" size="3" color="Red">לא נכתבה כתובת השיר</font></b>'; // test if the song url was`nt wrote. else { echo '<br><br><b><font face="arial" size="3" color="Red">הוספת את השיר בהצלחה</font></b>'; // success adding of the song. mysql_query ("INSERT INTO music VALUES ('off' , '$sband' , '$sname' , '$slink')"); // adding to mysql datebase. } } ?> <form method="POST"> <select name="sselect"> <? $mu = mysql_query ("SELECT * FROM music"); while ( $music = mysql_fetch_array ($mu) ) { echo "<option value='". $music['name'] ."'>" . $music['name'] . "- " .$music['band'] . ""; // All the options of the select action. } ?> </select> <br><br> <input type="submit" name="smusics" value="בחר שיר"> <? if (isset ($_POST['smusics'])) { $selectsong = $_POST['sselect']; mysql_query ("UPDATE TABLE music SET `stat`='off' WHERE `stat`='on'"); // set all the 'stat' songs off , where the songs are on. mysql_error(); // cheak for error. mysql_query ("UPDATE TABLE music SET `stat`='on' WHERE `name`='$selectsong'"); //adding 'on' on the select song. mysql_error(); // cheak for error. echo "<br><b><font face='arial' size='2'>בחרת את השיר</b><b> ". $selectsong ." </b><b>בהצלחה.</b></font>"; // success message. } ?> </form> </body> </html>
פעם ראשונה עבדתי מסודר (יחסית)
הוספת שירים עובד מצויין והם נכנסים למסד, רואים אותם בתיבת select ומכאן הבעיה,
אין שגיאה או משהו אבל זה פשוט לא הופך את השיר הנבחר לOn.. מה הבעיה בחלק הזה?
תודה מראש 
_____________________________________
--- ! Area Close ! ---
|