Gazz1982 Posted June 6, 2008 Share Posted June 6, 2008 I have a check box, when it is ticked I want it to ("insert 'yes' into dispose where (the checkbox is in the same table <td> </td> bit)") this code needs to be executed in another php file - so it is clicked then a button is pressed which goes (location:file.php) and then that row is deleted using ("delete * from login where ($_POST('varible'))"); here is my code so far <?php $con = mysql_connect("localhost","root","Gnob2007"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("register", $con); $result = mysql_query("SELECT * FROM login where VALIDATE = 'yes'"); echo "<table border='1'> <tr> <th>Delete</th> <th>Firstname</th> <th>Lastname</th> <th>Email</th> <th>Password</th> <th>Company</th> <th>Address1</th> <th>Address2</th> <th>Address3</th> <th>County</th> <th>Country</th> <th>Post Code</th> <th>Phone Number</th> <th>Validate</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><form class='small' name='login' method='post' action='delete.php?<?php echo SID?>'"; echo "<input type='checkbox' name='Delete' value='Delete' /></p></td>"; echo "<td>" . $row['NAME_FIRST'] . "</td>"; echo "<td>" . $row['NAME_LAST'] . "</td>"; echo "<td>" . $row['EMAIL'] . "</td>"; echo "<td>" . $row['PASSWORD'] . "</td>"; echo "<td>" . $row['COMPANY'] . "</td>"; echo "<td>" . $row['ADDRESS1'] . "</td>"; echo "<td>" . $row['ADDRESS2'] . "</td>"; echo "<td>" . $row['ADDRESS3'] . "</td>"; echo "<td>" . $row['COUNTY'] . "</td>"; echo "<td>" . $row['COUNTRY'] . "</td>"; echo "<td>" . $row['POST_CODE'] . "</td>"; echo "<td>" . $row['PHONE'] . "</td>"; echo "<td>" . $row['VALIDATE'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> thanks for any help Link to comment https://forums.phpfreaks.com/topic/109029-checkbox-insert-into-table/ Share on other sites More sharing options...
MatthewJ Posted June 6, 2008 Share Posted June 6, 2008 Maybe it is because it is Friday, but your question does not seem real clear. One thing I did notice though, is this line echo "<td><form class='small' name='login' method='post' action='delete.php?<?php echo SID?>'"; is going to cause a syntax error for a couple reasons... No need to use <?php ?> tags inside of an echo statement... you are already inside php tags just put the variable in like echo "<td><form class='small' name='login' method='post' action='delete.php?$SID; '"; and also, make sure it has a semicolon Link to comment https://forums.phpfreaks.com/topic/109029-checkbox-insert-into-table/#findComment-559316 Share on other sites More sharing options...
Gazz1982 Posted June 6, 2008 Author Share Posted June 6, 2008 sorry I have generated a table using php from a query I've made another column generate a checkbox (not linked to database) I want it so that when this is checked it updates the dispose column with the value: 'yes' is that clearer? Link to comment https://forums.phpfreaks.com/topic/109029-checkbox-insert-into-table/#findComment-559355 Share on other sites More sharing options...
Gazz1982 Posted June 6, 2008 Author Share Posted June 6, 2008 or is their a check box option for a mysql database? I have set it as DISPOSE CHAR(3) Link to comment https://forums.phpfreaks.com/topic/109029-checkbox-insert-into-table/#findComment-559357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.