0

hi guys.....can anyone help me.....having some problem with my coding.....here's i attached together my file.......my problem is the error come out saying that undefined index when i submit the point of contact form....help me guyz!!!he error come from saveproject.php....sequence of the file......

1- Createproject.php - create form and when user submit, displaycreateproject.php page will be display, then after the user submit from displaycreateproject.php, page saveproject.php will be execute and at the same time the next form from createproject.php will be displayed.....i need a help plzzz!!!!

Attachments
<html>
<head><script type="text/javascript" src="cal2.js">
</script><script language="javascript" src="cal_conf2.js"></script>
<title>create project</title></head>
<body background = "pictures/images.jpg" >
<img src = "pictures/top.png" 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">
  
  
  <form name="projectplan">
  <TR><br>Task Name:<input type="text" name="taskname" >

  <br><br>


  
  <tr>&nbsp;Start Date:&nbsp; <input type="text" name="datestart" size=20>&nbsp; <small><a href="javascript:showCal('Calendar1')">
  <img src = "calender.gif"></a></small><br><br>

  <tr>&nbsp;End Date:&nbsp;&nbsp; <input type="text" name="dateend" size=20>&nbsp; <small><a href="javascript:showCal('Calendar2')">
  <img src = "calender.gif"></a></small><br><br>&nbsp;Remarks:&nbsp;&nbsp;&nbsp; <input type="textarea" cols = "20" name="description" >  
                    
	
	<br><br>

	</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':
	
?>
	
<?php
	$projectid = $_GET["projectid"];
?>
	
	<form id="" name="pointofcontact" method="post" action="displaycreateproject.php">
	<input type = "hidden" name = "action" value = "pointofcontact">
	<input type = "hidden" name = "projectid" value = "<?php echo $projectid ?>">
	<input type="checkbox" name="poc[]" id="Asyiqin" value="Asyiqin">&nbsp;
	Asyiqin&nbsp;
	<br>
	<input type="checkbox" name="poc[]" id="Salwa" value="Salwa">&nbsp;
	Salwa&nbsp;
	<br>
	<input type="checkbox" name="poc[]"id="Erhilyaty"  value="Erhilyaty">&nbsp;
	Erhilyaty&nbsp;<br>


	

	<td colspan="2" align="right">&nbsp;<colspan="2" align="right"></td></tr>
	</form></form><br><input type="submit" value ="Submit"/>&nbsp; <input type="reset" value ="Reset"/><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" >
	<input type = "hidden" name = "action" value = "pointofcontact">
	<br>

<?php

$Notes =$_POST['poc'];
if (isset($_POST['fieldname'])) { $Notes = $_POST['fieldname']; }
foreach ($Notes as $value )
{
	
	echo "<p><script type='text/javascript'>confirmation('Pastikan pilihan anda betul!! ".$value."  ')</script></p>";
	echo $value;
}
?>
	<p>&nbsp;</p>
<SCRIPT LANGUAGE="JavaScript">
</script>
<input type=button value="BACK" onClick="history.go(-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'){
	
	$resourcesname=$_POST['poc'];
	$resourcescompany = $_POST['datestart']; 
	$resourcesdesignation = $_POST['dateend']; 
	$resourcesphone = $_POST['description'];
	$resourcesemail=$_POST['taskname'];
	$resourcessalary = $_POST['datestart']; 
	$username= $_POST['dateend']; 
	$password = $_POST['description'];
	$accesslevel=$_POST['taskname'];
	$resourceaddress = $_POST['datestart']; 
	
	
	$query = "insert into resources 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';
		
	}
}
?>
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by johnsquibb
0

try specifying method='POST" in all of of your <form> tags...like so:

<form name="pointofcontact" action = "saveproject.php" method="POST">

it seems like some of your forms are defaulting to GET, but you are reading all variables with $_POST...specifying the method type will prevent this variable confusion.

Also, a heads up...you are using using header function calls after echoing content throughout your saveproject.php file...not sure if this is due to you trying to debug, but the redirects will fail if the header tags follow an echo statement.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.