use isset($$key); ed
At 09:29 AM 5/30/2002 +1000, David Freeman wrote: >Hi All, > >I've been trying to figure this out based on stuff on php.net but can't >seem to get a result I need. > >I have an array: > >$formarray = array ("form1" => "var1", "form2" => "var2"); > >And now I'm using that array to create a form (fairly abbreviated): > >while (list($key, $val) = each($formarray)) >{ > echo "$val:"; > echo "<input name=\"$key\"> >} > >What I'm looking to do is set a value in my input tag if a value has >been set. That is, if this form has been submitted then the variable >$form1 will contain a value (well, $POST[$form1] will but you get the >idea). > >I want to test if $form1 has a value and if it does then I can add a >value= arg in my input tag. > >I've got as far as working out that $$key will give me the equivalent of >$form1 but how do I then work out if $form1 has a value? > >CYA, Dave > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php