Now that it is in vogue to have RegisterGlobals turned off by default, how do you do something like this:
<input name="edit" type="button" value="Edit" onClick="location.href='/addeditsite/index.php?site=1';"
Since you cannot pass variables in the URL, it wont work.
This is what I came up with using javascript to write the selection to the form variables before submission. Then I could process the $_POST values in the header and redirect. I think I am still missing something:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test</title>
<script language="JavaScript" type="text/javascript">
function setChoice (a,b) {
document.testForm.entryChoice.value = a;
document.testForm.entryOption.value = b;
document.testForm.submit();
//return false; This would set the value but not submit the form.
}
</script>
</head>
<body>
<?php
if(isset($_POST['entryChoice']) && isset($_POST['entryOption'])){
echo($_POST['entryChoice'] . "<br/>" . $_POST['entryOption']);
}
?>
<form action="" method="POST" id="testForm">
<table width="100%" border="1" cellspacing="0" cellpadding="3">
<tr>
<td>1</td>
<td nowrap="nowrap">This is a test entry</td>
<td width="100%"><input name="view" type="button" onClick="setChoice(1,1);" value="View">
<input name="edit" type="button" onClick="setChoice(1,2);" value="Edit"></td>
</tr>
<tr>
<td>2</td>
<td nowrap="nowrap">Yet another test entry</td>
<td width="100%"><input name="view" type="button" onClick="setChoice(2,1);" value="View">
<input name="edit" type="button" onClick="setChoice(2,2);" value="Edit"></td>
</tr>
</table>
</form>
</body>
</html>