actually, i want to display back all checked value in checkbox..In my form, there is some checkbox element where the user should check necessary value b4 submit the form....My problem is, once the user has submit the from, i can't retrieved only checked value.....it display all value including unchecked value in checkbox....so, if anyone can help me, it would be great....thanks in advance......
nav33n 472 Purple hazed! Team Colleague Featured Poster
Can you post your code ?
nikesh.yadav 4 Posting Whiz in Training
will u send me code
asyieen 0 Newbie Poster
this is the sequence of the code.....the user will create project (createproject.php) then once he click submit, the from will be displayed for confirmation (displaycreateproject.php) and lastly, when they submit the confirmation form , the data will be save in the database (saveproject.php)
<html>
<head><script type="text/javascript" src="claender.js">
</script>
<title>create project</title></head>
<body background = "pictures/images.jpg" >
<img src = "pictures/images1.jpg" width = "1000" height = "100">
<p><center><h3><b><font color = "#9999cc">Create Project</font></b></h3></center></p>
<?php
switch($_GET["action"]){
default:
?>
<b>Project Info</b><br>
<form name ="projectinfo" action = "displaycreateproject.php" method = "POST">
<input type = "hidden" name = "action" value= "projectinfo">
<table cellspacing="5" cellpadding="5" border="0">
<tr><td>Project Name:</td><td style = "padding-left:5px;"><input type="text" name="projectname" ></td></tr>
<tr><td>Date Awarded:</td><td style = "padding-left:5px;"><input type="text" name="dateawarded"></td></tr>
<tr><td>Start Date:</td><td style = "padding-left:5px;"><input type="text" name="datestart"></td></tr>
<tr><td>End Date:</td><td style="padding-left:5px;"><input type="text" name="dateend" ></td></tr>
<tr><td>Plan Release:</td><td style = "padding-left:5px;"><input type="text" name="releaseno"></td></tr>
<tr><td>Remarks:</td><td style = "padding-left:5px;"><input type="text" name="remarks"></td></tr>
</table><tr><td align = "center">
<td colspan="2" align="right"><input type="submit" value ="Submit"/>
<colspan="2" align="right"><input type="reset" value ="Reset"/></td></tr>
</form><br><br><br><br>
<?php
break;
case 'projectplan':
?>
<b>Project Plan / Activity List</b>
<?php
$projectid = $_GET["projectid"];
?>
<form name = "projectplan" action = "displaycreateproject.php" method = "post">
<input type = "hidden" name = "action" value = "projectplan">
<input type = "hidden" name = "projectid" value = "<?php echo $projectid ?>">
<table cellspacing="3" cellpadding="3" border="0">
<TR><br>Task Name:<input type="text" name="taskname" >
<form action="" method="post" enctype="multipart/form-data" name="formaddrem" >
<td align = "center"><br>Start Date:<input name="dop2" type="text" class="mbox3" id="dop2" value="" />
<a href="javascript:show_calendar('formaddrem.dop2');"><img src="calender.gif" width="21" height="17" border="0" align="absmiddle" /></a>
<br><br>End Date:<input name="dop2" type="text" class="mbox3" id="dop2" value="" />
<a href="javascript:show_calendar('formaddrem.dop2');"><img src="calender.gif" width="21" height="17" border="0" align="absmiddle" /></a>
<br><br>Remarks:<input type="textarea" cols = "20" name="description" >
</table><tr><td align = "center">
<td colspan="2" align="right"><input type="submit" value ="Submit"/>
<colspan="2" align="right"><input type="reset" value ="Reset"/></td></tr>
</form><br><br><br><br>
<?php
break;
case 'pointofcontact':
?>
<b>Point of Contact</b>
<?php
$projectid = $_GET["projectid"];
?>
<form name = "pointofcontact" action = "displaycreateproject.php" method = "post">
<input type = "hidden" name = "action" value = "pointofcontact">
<input type = "hidden" name = "projectid" value = "<?php echo $projectid ?>">
<form action="../" onsubmit="return checkCheckBoxes(this);">
Asyiqin
<input type="checkbox" name="Asyiqin" value="Asyiqin">
<br>
Salwa
<input type="checkbox" name="Salwa" value="Salwa">
<br>
Erhilyaty
<input type="checkbox" name="Erhilyaty" value="Erhilyaty">
<td colspan="2" align="right"><input type="submit" value ="Submit"/>
<colspan="2" align="right"><input type="reset" value ="Reset"/></td></tr>
</form></form><br><br><br><br>
<?php
break;
case "projectmanager":
?>
<b>Project Manager</b>
<?php
$projectid = $_GET['projectid'];
?>
<form name = "projectmanager" action = "displaycreateproject.php">
<input type = "hidden" name = "action" value = "projectmanager">
<input type = "hidden" name = "projectid" value = "<?php echo $projectid ?>">
<table cellspacing="5" cellpadding="5" border="0">
<tr><td align = "center">Project Manager:</td><td><select name="Asyiqin">
<option value="Asyiqin">Asyiqin</option>
<option value="Salwa" >Salwa</option>
</select></tr>
</table><tr><td align = "center">
<td colspan="2" align="right"><input type="submit" value ="Submit"/>
</td></tr>
</form><br><br><br><br>
<?php
break;
case "uploaddownload":
?>
<b>Upload / Download Document</b>
<?php
$projectid = $_GET ["projectid"];
?>
<form uploaddownload action = "displaycreateproject.php">
<input type = "hidden" name = "action" value = "uploaddownload">
<input type = "hidden" name = "projectid" value = "<?php echo $projectid ?>">
<table cellspacing="5" cellpadding="5" border="0">
<tr><td align = "center">Project ID:</td><td style = "padding-left:5px;"><input type="text" name="projectid" ></td></tr>
<tr><td align = "center">Document Name:</td><td style = "padding-left:5px;"><input type="text" name="docname"></td></tr>
<tr><td align = "center">Remarks:</td><td style = "padding-left:5px;"><input type="text" name="remarks"></td></tr>
<tr><td align="center">File:</td><td style="padding-left:5px;"><input type="text" name="uploadfile" ><a href = "Browse"></a></td></tr>
</table><tr><td align = "center">
<td colspan="2" align="right"><input type="submit" value ="Submit"/>
<colspan="2" align="right"><input type="reset" value ="Reset"/></td></tr>
</form>
<?php
}
?>
</body>
</html>
<?php
if ($_POST['action']=='projectinfo'){
?>
<form name="projectinfo" action = "saveproject.php" method = "post">
<table>
<tr>
<td> Project Name : <?php echo $_POST['projectname'] ?>
<input type = "hidden" name = "projectname" value = "<?php echo $_POST ['projectname'] ?>">
</td>
</tr>
<tr>
<td> Date Awarded : <?php echo $_POST ['dateawarded'] ?>
<input type = "hidden" name = "dateawarded" value = "<?php echo $_POST['dateawarded'] ?>">
</td>
</tr>
<tr>
<td> Start Date : <?php echo $_POST ['datestart'] ?>
<input type = "hidden" name = "datestart" value = "<?php echo $_POST['datestart'] ?>">
</td>
</tr>
<tr>
<td> End Date : <?php echo $_POST ['dateend'] ?>
<input type = "hidden" name = "dateend" value = "<?php echo $_POST['dateend'] ?>">
</td>
</tr>
<tr>
<td> Plan Release: <?php echo $_POST ['releaseno'] ?>
<input type = "hidden" name = "releaseno" value = "<?php echo $_POST['releaseno'] ?>">
</td>
</tr>
<tr>
<td> Remarks: <?php echo $_POST ['remarks'] ?>
<input type = "hidden" name = "remarks" value = "<?php echo $_POST['remarks'] ?>">
</td>
</tr>
<input type = "hidden" name = "action" value = "projectinfo">
<INPUT TYPE="button" VALUE=" BACK " onClick="goHist(-1)">
<INPUT TYPE="Submit" VALUE="NEXT" >
</form>
<?php
}
else if ($_POST['action'] == 'projectplan'){
?>
<input type = "hidden" name = "projectid" value = "<?php $_POST ['projectid']?>">
<form name="projectplan" action = "saveproject.php" method = "post">
<table>
<tr>
<td> Task Name : <?php echo $_POST['taskname'] ?>
<input type = "hidden" name = "taskname" value = "<?php echo $_POST ['taskname'] ?>">
</td>
</tr>
<tr>
<td> Start Date : <?php echo $_POST ['datestart'] ?>
<input type = "hidden" name = "datestart" value = "<?php echo $_POST['datestart'] ?>">
</td>
</tr>
<tr>
<td> End Date : <?php echo $_POST ['dateend'] ?>
<input type = "hidden" name = "dateend" value = "<?php echo $_POST['dateend'] ?>">
</td>
</tr>
<tr>
<td> Remarks: <?php echo $_POST ['description'] ?>
<input type = "hidden" name = "description" value = "<?php echo $_POST['description'] ?>">
</td>
</tr>
<input type = "hidden" name = "action" value = "projectplan">
<SCRIPT LANGUAGE="JavaScript">
</script>
<INPUT TYPE="button" VALUE=" BACK " onClick="goHist(-1)">
<INPUT TYPE="Submit" VALUE="NEXT" >
</form>
<?php
} else if ($_POST['action'] == 'pointofcontact'){
?>
<input type = "hidden" name = "projectid" value = "<?php $_POST ['projectid']?>">
<form name="pointofcontact" action = "saveproject.php" >
Asyiqin
<input type="hidden" name="person" value="Asyiqin">
<br>
Salwa
<input type="hidden" name="person" value="Salwa">
<br>
Erhilyaty
<input type="hidden" name="person" value="Erhilyaty">
<input type = "hidden" name = "action" value = "pointofcontact">
<SCRIPT LANGUAGE="JavaScript">
</script>
<INPUT TYPE="button" VALUE=" BACK " onClick="goHist(-1)">
<INPUT TYPE="Submit" VALUE="NEXT" >
</form>
<?php
} else if ($_POST['action'] == 'projectmanager'){
?>
<input type = "hidden" name = "projectid" value = "<?php $_POST ['projectid']?>">
<?php
} else if ($_POST['action'] == 'uploaddownload'){
?>
<input type = "hidden" name = "projectid" value = "<?php $_POST ['projectid']?>">
<?php
}
?>
</table>
</body>
</html>
<?php
$dbhost = 'localhost';
$dbusername = "root";
$dbpasswd = "";
$database_name = "pms";
/* Database Stuff, do not modify below this line */
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to host." . mysql_error());
$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.". mysql_error());
if ($_POST['action'] == 'projectinfo'){
$projectname=$_POST['projectname'];
$dateawarded = $POST ['dateawarded'];
$datestart = $_POST ['datestart'];
$dateend = $_POST ['dateend'];
$releaseno = $_POST ['releaseno'];
$remarks = $_POST['remarks'];
$query = "insert into projectmain set projectname = '$projectname', dateawarded = 'dateawarded', datestart ='datestart', dateend = 'dateend', releaseno = 'releaseno', remarks = 'remarks'";
$result = mysql_query ($query);
$projectid = mysql_insert_id();
if ($result){
echo $_POST ['action'];
header ('Location: createproject.php?action=projectplan&projectid='. $projectid);
} else {
echo 'Error';
}
} else if ($_POST ['action'] == 'projectplan'){
$taskname=$_POST['taskname'];
$datestart = $_POST['datestart'];
$dateend = $_POST['dateend'];
$description = $_POST['description'];
$query = "insert into projecttaskmain set taskname = '$taskname', datestart = 'datestart', dateend = 'dateend', description ='$description'";
$result = mysql_query ($query);
$projectid = mysql_insert_id();
if ($result){
echo $_POST ['action'];
header ('Location: createproject.php?action=pointofcontact&projectid='. $projectid);
} else {
echo 'Error';
}
} else if ($_POST ['action'] == 'pointofcontact'){
$taskname=$_POST['taskname'];
$datestart = $_POST['datestart'];
$dateend = $_POST['dateend'];
$description = $_POST['description'];
$query = "insert into projecttaskmain set taskname = '$taskname', datestart = 'datestart', dateend = 'dateend', description ='$description'";
$result = mysql_query ($query);
$projectid = mysql_insert_id();
if ($result){
echo $_POST ['action'];
header ('Location : createproject.php?action=projectmanager&projectid='. $projectid);
} else {
echo 'Error';
}
}
?>
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.