DarkPrince2005 Posted September 2, 2009 Share Posted September 2, 2009 Has anyone got an idea as to what I'm doing wrong, and how I can get it to work? $content = "<form action='a.php' method='post'><table border=1>"; $content .= "<tr><td>Name Surname</td><td>Pet Name</td><td>Case Complaint</td><td>Payment Type</td><td>Payment Status</td><td>Responded</td><td>View</td><td> </td></tr>"; for ($i=0;$i<count($cases);$i++) { if (!(has_responses($cases[$i]['case_id'])) && ($archive==false)) { $user = user_details($cases[$i]['userid']); $pet = user_pet_details($cases[$i]['pets_id']); $content .= "<tr><td>".$user['name'] ." ".$user['surname']."</td><td>".$pet['pets_name']."</td><td>".$cases[$i]['case_complaint']."</td><td>".$cases[$i]['payment_type']."</td><td><input type='hidden' name='payment_status' value=".$cases[$i]['payment_status'].">".$cases[$i]['payment_status']."</td><td>".$cases[$i]['responded']."</td><td><a href=cases.php?id=".$cases[$i]['case_id'].">View</td><td><input name='move[]' type='checkbox' value=".$cases[$i]['case_id']."></td></tr>"; } else if (($archive) && (has_responses($cases[$i]['case_id']))) { $user = user_details($cases[$i]['userid']); $pet = user_pet_details($cases[$i]['pets_id']); $content .= "<tr><td>".$user['name'] ." ".$user['surname']."</td><td>".$pet['pets_name']."</td><td>".$cases[$i]['case_complaint']."</td><td>".$cases[$i]['payment_type']."</td><td><input type='hidden' name='payment_status' value=".$cases[$i]['payment_status'].">".$cases[$i]['payment_status']."</td><td>".$cases[$i]['responded']."</td><td><a href=cases.php?id=".$cases[$i]['case_id'].">View</td><td><input name='move[]' type='checkbox' value=".$cases[$i]['case_id']."></td></tr>"; } } $content .= "<tr><td><input type='submit' value='submit'></td></tr></table><form>"; <?php mysql_connect("localhost", "root", "") or die ("Could not connect"); mysql_select_db("dbase") or die ("Could not connect to DB"); if ($_POST['move']) { foreach($_POST["move"] as $key => $id) { $tt = $_POST['payment_status']; if($tt == "NOT PAID"){ $sql1=mysql_query("select * FROM `case` WHERE `case_id` = '".(int)$id."' limit 0,1") or die(mysql_error()); $sql=mysql_query("update `case` SET `payment_status` = 'PAID' WHERE `case_id` like '".(int)$id."'") or die(mysql_error()); } ELSE if($tt == "PAID"){ $sql1=mysql_query("select * FROM `case` WHERE `case_id` = '".(int)$id."' limit 0,1") or die(mysql_error()); $sql=mysql_query("update `case` SET `payment_status` = 'NOT PAID' WHERE `case_id` like '".(int)$id."'") or die(mysql_error()); } } } else { echo "please select at least one row, to delete it"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/ Share on other sites More sharing options...
Zyx Posted September 2, 2009 Share Posted September 2, 2009 And what IS wrong? Parse error? Execution error? Something else? Give more information, what it is supposed to do and what actually does. Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-910736 Share on other sites More sharing options...
DarkPrince2005 Posted September 2, 2009 Author Share Posted September 2, 2009 Well, it's suppose to check if a checkbox is ticket and what the payment status of that particular record is and depending on it's value change it. At the moment it isn't doing anything not even an error. Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-911102 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 so there is a blank page? try clicking view source to make sure there isn't an error being posted there Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-911105 Share on other sites More sharing options...
DarkPrince2005 Posted September 2, 2009 Author Share Posted September 2, 2009 yup a blank page and no error, it's as if it's not posting the payment_status value Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-911107 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 Oh... well of course its blank you don't output anything in your second script (which i assume is a.php) if you want to see some output output something. like echo a finished message at the end or something Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-911108 Share on other sites More sharing options...
DarkPrince2005 Posted September 7, 2009 Author Share Posted September 7, 2009 Can anyone see what I'm doing wrong to pass the variable? form $content = "<form action='a.php' method='post'><table border=1>"; $content .= "<tr><td>Name Surname</td><td>Pet Name</td><td>Case Complaint</td><td>Payment Type</td><td>Payment Status</td><td>Responded</td><td>View</td><td> </td></tr>"; for ($i=0;$i<count($cases);$i++) { if (!(has_responses($cases[$i]['case_id'])) && ($archive==false)) { $user = user_details($cases[$i]['userid']); $pet = user_pet_details($cases[$i]['pets_id']); $content .= "<tr><td>".$user['name'] ." ".$user['surname']."</td><td>".$pet['pets_name']."</td><td>".$cases[$i]['case_complaint']."</td><td>".$cases[$i]['payment_type']."</td><td><input type='hidden' name='payment_status' value=".$cases[$i]['payment_status'].">".$cases[$i]['payment_status']."</td><td>".$cases[$i]['responded']."</td><td><a href=cases.php?id=".$cases[$i]['case_id'].">View</td><td><input name='move[]' type='checkbox' value=".$cases[$i]['case_id']."></td></tr>"; } else if (($archive) && (has_responses($cases[$i]['case_id']))) { $user = user_details($cases[$i]['userid']); $pet = user_pet_details($cases[$i]['pets_id']); $content .= "<tr><td>".$user['name'] ." ".$user['surname']."</td><td>".$pet['pets_name']."</td><td>".$cases[$i]['case_complaint']."</td><td>".$cases[$i]['payment_type']."</td><td><input type='hidden' name='payment_status' value=".$cases[$i]['payment_status'].">".$cases[$i]['payment_status']."</td><td>".$cases[$i]['responded']."</td><td><a href=cases.php?id=".$cases[$i]['case_id'].">View</td><td><input name='move[]' type='checkbox' value=".$cases[$i]['case_id']."></td></tr>"; } } $content .= "<tr><td><input type='submit' value='submit'></td></tr></table><form>"; Request <?php mysql_connect("localhost", "root", "") or die ("Could not connect"); mysql_select_db("cyberndt_cybervet") or die ("Could not connect to DB"); if ($_POST['move']) {$tt = $_POST['payment_status']; foreach($_POST['move'] as $key => $id) { if($tt == "NOT PAID"){ $sql1=mysql_query("select * FROM 'case' WHERE 'case_id' = '".(int)$id."' limit 0,1") or die(mysql_error()); $sql=mysql_query("update 'case' SET 'payment_status' = 'PAID' WHERE 'case_id' like '".(int)$id."'") or die(mysql_error()); echo "not paid value changed to paid"; } ELSE if($tt == "PAID"){ $sql1=mysql_query("select * FROM 'case' WHERE 'case_id' = '".(int)$id."' limit 0,1") or die(mysql_error()); $sql=mysql_query("update 'case' SET 'payment_status' = 'NOT PAID' WHERE 'case_id' like '".(int)$id."'") or die(mysql_error()); echo "paid value changed to not paid"; } else { echo "please select at least one row, to delete it"; }} } ?> Quote Link to comment https://forums.phpfreaks.com/topic/172792-postingif-statement/#findComment-913970 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.