Posted: Fri Aug 19, 2005 5:29 am
try using $_REQUEST instead of $_POST and let me know (how are you submitting the form and what is the form action and method?)
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
this is my code so far, still undefined index...korto wrote:try using $_REQUEST instead of $_POST and let me know (how are you submitting the form and what is the form action and method?)
Code: Select all
<select name='companyrole'>
<option value=''> - Select Company's Role - </option>
<option value='Contractor' <? if ($_REQUEST['companyrole'] == 'Contractor') echo "selected"; ?>>Contractor</option>
<option value='Sub-Contractor' <? if ($_REQUEST['companyrole'] == 'Sub-Contractor') echo "selected"; ?>>Sub-Contractor</option>
<option value='Outsourcing' <? if ($_REQUEST['companyrole'] == 'Outsourcing') echo "selected"; ?>>Outsourcing</option>
</select>Code: Select all
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" >Code: Select all
<? if(!isset($_POST['companyrole'])) {
$companyrole = '';
}
else {
$companyrole = $_POST['companyrole'];
}
?>
<select name='companyrole'>
<option value=''> - Select Company's Role - </option>
<option value='Contractor' <? if ($companyrole == 'Contractor') echo "selected"; ?>>Contractor</option>
<option value='Sub-Contractor' <? if ($companyrole == 'Sub-Contractor') echo "selected"; ?>>Sub-Contractor</option>
<option value='Outsourcing' <? if ($companyrole == 'Outsourcing') echo "selected"; ?>>Outsourcing</option>
</select>