Hi all Please help me to Solve this problem. I am doing small project i which i have one select list(drop-down) ,in which i get the data from database .Select list contained the name of the student.(from student info table) .When you select one name from the list ,it create dynamic table on the same page where the selected name is added.My problem is that when you select name and it is added to table ,the selected name should be deleted from drop down list only and not from the database. please help me its urgent
while ($studentinfo = mysql_fetch_assoc($query)) { if ($_REQUEST['name'] == $studeninfo['name']) { continue; } echo '<option value="'. $studentinfo['name'] .'">'. $studentinfo['name'] .'</option>'. "\n"; } PHP: If this doesn't help... post your code. All I can do is guess.
hi thank you for your quick reply .I already tried this solution can you suggest any other way to pop up the alert which says the selefcted value is already existed in the table. Than k you
Since he's dealing with client side, I think he needs javascript instead of php. Here try this: <html> <head> <title>test</title> </head> <script> function addnew(newname) { if(newname) { var content = document.getElementById("valueholder"); var tableholder = document.getElementById("tableholder"); var dynamictable = "<table border=1 width=200><tr><td>"; dynamictable += newname + "<br>" + content.innerHTML; dynamictable += "</td></tr></table>"; tableholder.innerHTML = dynamictable; content.innerHTML = newname + "<br>" + content.innerHTML; } } </script> <body> <div id="valueholder" style="display:none"></div> <div id="tableholder"></div> <select name="studentList" onchange="addnew(this.options[this.selectedIndex].value); this.options[this.selectedIndex].value=''"> <option value="">Select a name</option> <option value="student name 1">student name 1</option> <option value="student name 2">student name 2</option> <option value="student name 3">student name 3</option> <option value="student name 4">student name 4</option> <option value="student name 5">student name 5</option> </select> </body> </html> PHP: All you need to do is replace dropdown list with the one you have in your database.