avincent Posted November 3, 2009 Share Posted November 3, 2009 I have a problem I am trying to get figured out. I have gone over the code about a million times and cant see why it is not working. HELP I am trying to pull client requests from the database and display them. Once they are displayed I want the user to be able to check the "checkbox or pre-filled textbox like this code is" for completed and then it updates the database with the information "yes" or "true" so that the records with this info in that field do not display again. ------Start Page ------ <?php //Create registration form (register.php) include "db_connect.php"; if(!isset($_POST['submit'])) { echo "<fieldset><legend><h2>Trouble Ticket List</h2></legend>"; $sql = "SELECT * FROM `online-form` WHERE `completed` = ''"; $query = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($query)) { $name= $row["name"]; $phone= $row["phone"]; $email= $row["email"]; $domain= $row["domain-name"]; $comments= $row["comments"]; $completed= $row["completed"]; ?> <form action="completed.php" method="post" > <dl> <dt >Name:</dt> <dd><?php echo "$name" ?><br><br></dd> </dl> <dl> <dt><label for="phone">Phone:</label></dt> <dd><?php echo "$phone" ?><br><br></dd> </dl> <dl> <dt><label for="domain">Domain Name:</label></dt> <dd><?php echo "$domain" ?><br><br></dd> </dl> <dl> <dt><label for="email">Email Address:</label></dt> <dd><?php echo "$email" ?><br><br></dd> </dl> <dl> <dt><label for="comments">Comments:</label></dt> <dd><?php echo "$comments" ?><br><br></dd> </dl> <dl> <dt><label for="completed">Completed:</label></dt> <dd><input type="type" name="completed" id="completed" value="yes" /><br><br></dd> </dl> <?php } } ?> <dl> <dt><input type="submit" name="submit" id="submit" value="Submit" /></dt> </dl> </fieldset> </form> --------Once the form has been submitted-------------- <?php //Create registration form (register.php) include "db_connect.php"; if(isset($_POST['submit'])) { $completed = $_REQUEST['completed']; $sql = "UPDATE `online-form` SET `completed` = '$completed'"; }else{ echo "your request has already been submitted"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.