Jump to content

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.