pixeltrace Posted February 25, 2007 Share Posted February 25, 2007 guys, i need help, i have a checkbox for 'j_type' which is in my update form page. on that form i have a row there that will display the current job type now in my process page i have a if else condition there that if none of the check box was checked the current value on the current job_type will be the value to be updated. below is my codes for the update form page <form action="job/updatejob.php" method="post"> <tr> <td align="right" valign="top" class="text6">Job Type :</td> <td> </td> <td class="text3"> <input type="checkbox" name="jtype[]" value="Permanent"> Permanent <input type="checkbox" name="jtype[]" value="Contract"> Contract <input type="checkbox" name="jtype[]2" value="Part-Time" /> Part-Time</td> </tr> <tr> <td align="right" valign="top" class="text6">Current Job Type :</td> <td> </td> <td class="text3"> <? $ljtype = explode(", ",$j_type); echo implode(",",$ljtype) ; ?> </td> </tr> <tr> <td rowspan="2"> </td> <td rowspan="2"> </td> <td><input type="submit" name="Submit" value="save" /> <input type="hidden" name="username" value="<? echo "$username"; ?>"> <input type="hidden" name="jobid" value="<? echo "$jobid"; ?>"> <input type="hidden" name="ljtypt" value="<? echo "$ljtype"; ?>"> </td> </tr> and this is the condition code that i have in my updatejob.php <? $ljtype = $_GET['ljtype']; $jtype = $_POST['jtype']; if ($jtype == "") { $jtype = "$ljtype" ; } else { $jtype = implode(",\n", $_POST['jtype']); } include '../db_connect.php'; $sql="UPDATE job_ads SET j_position='$jposition', c_name='$cname', cperson='$cperson', specialization='$specialization', level='$level', industry='$industry', c_description='$cdescription', j_requirements='$jrequirements', j_responsibilities='$jresponsibilities', j_type='$jtype', salary='$salary', location = '$location', country='$country', date_posted='$dateposted', date_closed='$dateclosed', j_status='$jstatus', remarks='$remarks', staff_updated='$staff_updated', date_updated='$date_updated' WHERE jobid='$jobid'"; mysql_query($sql) or die("error:".mysql_error()); ?> whats wrong in my codes. hope you could help me with this. thanks! Link to comment https://forums.phpfreaks.com/topic/39998-check-box-update-problem/ Share on other sites More sharing options...
pixeltrace Posted February 25, 2007 Author Share Posted February 25, 2007 any help for this one? thanks! Link to comment https://forums.phpfreaks.com/topic/39998-check-box-update-problem/#findComment-193439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.