What error exactly ?
here are the errors,
Warning: Invalid argument supplied for foreach() in C:\wamp\www\dynamic\edit.php on line 16Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\dynamic\edit.php on line 25
<form id="form1" name="form1" method="post" action="edit.php"> team: <input type="text" name="team" /><br /> <br> <?php $sql = 'SELECT * From team'; $con = mysql_connect("localhost","root","talk21") or die; $result = mysql_db_query(lastr, $sql); while ($rec = mysql_fetch_array($result)) { print "\n<input type='checkbox' name=team[]' value='".$rec['id']."'checked> ".$rec['team']." </input>"; } if(isset($_POST['submit'])){ $q="delete from team"; //delete all the teams mysql_query($q); foreach($_POST['team'] as $value){ $q="insert into team (team) values ('$value')"; mysql_query($q); //so by the end, the table will have records which were checked and all the records which were unchecked will be removed. } } //I list these teams in my form. $q="select id,team from table"; $res=mysql_query($q); echo "<form method='post' action='check.php'>"; while($row=mysql_fetch_array($res)){ echo "<input type='checkbox' name='team[]' value='$id' checked>".$team."<br />"; //this will list all the teams in the database } echo "<input type='submit' name='submit' value='submit'>"; echo "</form>";
asadalim1 0 Light Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster
asadalim1 0 Light Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster
asadalim1 0 Light Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster
asadalim1 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.