Jump to content

xiizth

Members
  • Posts

    9
  • Joined

  • Last visited

xiizth's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I have a form for checking if equipment is in good working order for my local fire department. I cannot get the checkboxes to proccess correctly. What i am trying to do is... This is just the mid section of the form... The $line_of_text var is loaded form a csv file. <td align="center" valign="middle" bgcolor="' . $clr . '"><input type="hidden" name="' . $line_of_text[2] . '_check" id="' . $line_of_text[2] . '" value="' . $line_of_text[2] . '"/>' . $line_of_text[1] . '</td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_1" name="' . $line_of_text[2] . '_element_2_1" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_1">PASS ALARM</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_2" name="' . $line_of_text[2] . '_element_2_2" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_2">CONNECTION</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_3" name="' . $line_of_text[2] . '_element_2_3" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_3">MASK/TUBE</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_4" name="' . $line_of_text[2] . '_element_2_4" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_4">SANITIZED</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_5" name="' . $line_of_text[2] . '_element_2_5" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_5">PSI CHECK</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_6" name="' . $line_of_text[2] . '_element_2_6" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_6">LUBRICATION</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><input id="' . $line_of_text[2] . '_element_2_7" name="' . $line_of_text[2] . '_element_2_7" class="radio" type="checkbox" value="1" /><label class="choice" for="element_2_7">BATTERIES</label></td><td align="center" valign="middle" bgcolor="' . $clr . '"><label class="description" for="element_1"></label><input name="' . $line_of_text[2] . '_element_1_comment" type="text" class="element textarea medium" id="' . $line_of_text[2] . '_element_1_comment" value="" /></td></tr>'; This is a bit of the submit code //AIR-PACK CHECK if(substr($k, -6, 6) == "_check") { $base = substr($k, 0, strlen($k) - strlen('_check')); // remove '_check' from the end of $k //echo 'base is ' . $base . '<br>'; $title = $v; $item_1 = $_REQUEST[$base . '_element_2_1']; $item_2 = $_REQUEST[$base . '_element_2_2']; $item_3 = $_REQUEST[$base . '_element_2_3']; $item_4 = $_REQUEST[$base . '_element_2_4']; $item_5 = $_REQUEST[$base . '_element_2_5']; $item_6 = $_REQUEST[$base . '_element_2_6']; $item_7 = $_REQUEST[$base . '_element_2_7']; $item_comment = $_REQUEST[$base . 'element_1_comment']; $message=$message . '<b><font color="black" size==4>' . $title . '</font></b><br>'; if($item_1=="1") { $message=$message . '<b><font color="blue">' . "THE PASS ALARM HAS BEEN CHECKED AND IS READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE PASS ALARM" . '</font></b><br>'; if($item_2=="1") { $message=$message . '<b><font color="blue">' . "THE CONNECTIONS HAVE BEEN CHECKED AND ARE READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE CONNECTIONS" . '</font></b><br>'; } if($item_3=="1") { $message=$message . '<b><font color="blue">' . "THE MASK AND TUBING HAS BEEN CHECKED AND IS READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE MASK AND OR TUBING" . '</font></b><br>'; if($item_4=="1") { $message=$message . '<b><font color="blue">' . "THE EQUIPMENT HAS BEEN SANITIZED AND IS READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE EQUIPMENTS SANITIZATION" . '</font></b><br>'; if($item_5=="1") { $message=$message . '<b><font color="blue">' . "THE PSI HAS BEEN CHECKED AND IS READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE PSI LEVEL" . '</font></b><br>'; if($item_6=="1") { $message=$message . '<b><font color="blue">' . "THE PACK HAS BEEN LUBRICATED AND IS READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE PACKS LUBRICATION" . '</font></b><br>'; if($item_7=="1") { $message=$message . '<b><font color="blue">' . "THE BATTERIES HAVE BEEN CHECKED AND ARE READY TO GO" . '</font></b><br>'; } else $message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE PACKS BATTERIES" . '</font></b><br>'; $message=$message . '<font color="green">' . "COMMENT: " . $item_comment . '</font><br><br>'; depending on the condition of the check box it should add to the $message var. Not sure why it is acting wacky
  2. I haven't been able to work on this is quite a while. Life gets in the way. I have been trying to make this whole process a lot more easy for me to maintain. I have decided to have a have php read a csv file and output to an html table. It seems to be working-ish. Still some bugs to work out. I guess the issue I have is the submit function that you helped me with before is now not working because the vars that I had no longer exist. I hope im not doing the wrong thing by opening this topic back up. this is my code... <html><head><title>PPFD</title><link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /><script src="js/prototype.js" type="text/javascript"></script><script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script><script src="js/lightbox.js" type="text/javascript"></script><style type="text/css">#checklist{ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; width: 100%; border-collapse: collapse;}#checklist td, #checklist th{ font-size-:1em; border:1px solid #98bf21; passing:3px 7px 2px 7px} #checklist th{ font-size:1.1em; text-align:center; padding-top:5px; padding-bottom:4px; background-color:#A7C942; color:#ffffff;}#checklist tr.alt td{ color:#000000; background-color:#EAF2D3;}</style></head><body><h1 align="center">PAINTED POST FIRE DEPARTMENT</h1><h1 align="center">ENGINE AND STATION CHECK SHEET</h1><!-- Truck name --><p align="center"><strong>B67</strong></p><!-- NAME YOU WANT TO GIVE TO THE TRUCK FORM --><form id="truck_check_m67_form" name="truck_check_m67_form" method="post" action="submit.php"><?phpecho '<table id="checklist"><tr><th width="35%">ENGINE CHECKS</th><th width="24%">ACCOUNTED</th><th width="30%">COMMENT</th><th width="11%">PICTURE</th></tr>';$file_handle = fopen("b67.csv", "r");$odd = true;$colors = array('#E0E0E0', '#FFFFFF');while (!feof($file_handle) ) { $line_of_text = fgetcsv($file_handle, 1024); $odd = true; while ($line_of_text) { if ($odd) { $clr = $colors[0]; $odd = false; } else { $clr = $colors[1]; $odd = true; } echo ' <tr> <td align="center" valign="middle" bgcolor="'.$clr.'">'.$line_of_text[0].'</td><td align="center" valign="middle" bgcolor="'.$clr.'"><label><input type="radio" name="'.$line_of_text[1].'" value="YES" id="'.$line_of_text[1].'_accounted_0" />Yes</label><label><input type="radio" name="'.$line_of_text[1].'" value="NO" id="'.$line_of_text[1].'_accounted_1" />No</label></td><td align="center" valign="middle" bgcolor="'.$clr.'"><input type="text" name="'.$line_of_text[2].'_comment" id="'.$line_of_text[2].'_comment" /></td><td align="center" valign="middle" bgcolor="'.$clr.'"><a href="images/image_comming_soon.jpg" rel="lightbox"><img src="images/question_mark_icon.jpg" width="30" height="30" /></a></td> </tr>'; $line_of_text = fgetcsv($file_handle, 1024); } }fclose($file_handle); echo '</table>'; ?><p align="center"><input name="email" type="hidden" value="B67_TRUCK_CHECKLIST@PPFD.COM" size="30" /></p><p align="center"><input type="submit" name="SUBMIT" id="SUBMIT" value="Submit" /></p></form></body></html>
  3. Removing the 1 from strlen seemed to fix the issue! is there a way for it to not scan the submit request? Thank you for your help. You have really made my day!
  4. checking x2_spanner_wrenches_titleposition of _title: 19length: 25checking x2_spanner_wrenchesposition of _title:length: 19checking x2_spanner_wrenches_commentposition of _title:length: 27checking class_a_foam_titleposition of _title: 12length: 18checking class_a_foamposition of _title:length: 12checking class_a_foam_commentposition of _title:length: 20checking emailposition of _title:length: 5checking SUBMITposition of _title:length: 6 Here is the output with the echos in there. Thanks
  5. This is the output i am getting: checking x2_spanner_wrenches_titlechecking x2_spanner_wrencheschecking x2_spanner_wrenches_commentchecking class_a_foam_titlechecking class_a_foamchecking class_a_foam_commentchecking emailchecking SUBMITYour mail was sent successfully Shouldn't it echo the title, item, and comment? Thanks
  6. Thank you for the reply. I should have started off with saying that I am very new to php. So I really appreciate your help. I’ve attached one of the previous html forms with the corresponding php script. It works; I just know there is a better way of achieving the same goal without retyping all the script over again. The vehicle check list I attached has the fewest amounts of items that we check for.Thank you so much! m13_tcheck.html m13_tcheck_submit.php
  7. This is not ment to be a double post. Just trying to provide more information. I dont want to have to keep copy and pasting the larger block of code over and over again.Thanks $class_a_foam = $_REQUEST["class_a_foam"];$class_a_foam_comment = $_REQUEST["class_a_foam_comment"]; //CLASS A FOAM$title="CLASS A FOAM";$item=$class_a_foam;$item_comment=$class_a_foam_comment; $message=$message . '<b><font color="black" size=4>' . $title . '</font></b><br>';if ($item=="YES")$message=$message . '<b><font color="blue">' . "THE " . $title . " IS ACCOUNTED FOR AND IN GOOD WORKING ORDER" . '</font></b><br>';else$message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE " . $title . "!!!" . '</font></b><br>';$message=$message . '<font color="black">' . "COMMENT: " . $item_comment . '</font><br><br>';
  8. I’ve been looking all over and I cannot seem to figure out how to do this…Id like to combine all of this… $message=$message . '<b><font color="black" size=4>' . $title . '</font></b><br>';if ($item=="YES")$message=$message . '<b><font color="blue">' . "THE " . $title . " IS ACCOUNTED FOR AND IN GOOD WORKING ORDER" . '</font></b><br>';else$message=$message . '<b><font color="red">' . "THERE IS A PROBLEM WITH THE " . $title . "!!!" . '</font></b><br>';$message=$message . '<font color="black">' . "COMMENT: " . $item_comment . '</font><br><br>';I want to be able to call this block of code and have the variables inseted into it. I am creating this for my local fire department which i am a member of. Any help would be great.
×
×
  • Create New...