Jump to content

Passing variables wtih in the reloading applicaion


learningPHP1

Recommended Posts

Hello everybody,

 

Having problems keeping variables within the same page when the content of the page is saved or when the page is reloads to add the next set of data.

The application is a data collecting page so I would need to keep certain variables the same as the same variables needs to appear in the next record.

Looking at the code below, 2 variables are received into the page but it won?t stay if I hit the add button basically reloading the page.

need the 2 variables returned back after clicking save.

 

<?php
echo "<br/>". $TaskId = $_POST['taskid1'];
echo "<br/>". $Site = $_POST['site'];
?>

<body>
<form name="projectwalkthrough" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >

	Task ID: <select name="taskid1" > 
	<option value="selectid"> <?PHP if($TaskId) {echo $TaskId;} else {echo "Select Task ID";} ?></option>
		<?PHP        
			while($row1=mysqli_fetch_array($ProjectIDResults))
				{  echo '<option value=" ' . $row1['ci_taskid'] . ' ">' . $row1['ci_taskid'] . '</option>';  }		
		?>
	</select>  

	Site: <select name="site" > 
		<option value="projectsite" > <?PHP if($Site) {echo $Site;} else {echo "select site";} ?></option>
		<?PHP
			while($row=mysqli_fetch_array($ProjectSiteResults))
			{  echo '<option value=" ' . $row['ps_site_short']  . ' ">' . $row['ps_site_short'] . '</option>';  }
		?>
	</select>
    <input type="submit" name="savewalkthrough" id="button" value="Save current scope" />

</body>
</form>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.