Forum Moderators: coopster
When the form is submitted it passes the checkbox value onto a section of code which pupulates the database.
The issue is with the check box - if checked it will pass the word "Pending" and i assumed that if the check box isnt checked it passes "" or "NULL".
My query says update table column with Pending if value of checkbox is pending and update with word "Requested" is checkbox is empty/NULL
problem is that the check box to my script technically doesnt exisit as it is never checked - my array is then out of sync.
The question is can i have the checkbox set so that it sends a value regardless of if it is checked or not?
something like this -
<input type = "checkbox" name ="yespending[]" <?php if(CHECKED){echo "value=/"Pending/"";}else{echo "value=/"Requested/"";}>
what do you reckon?
Try isset() [php.net].
the varible technically wont exisit if the check box isnt checked
That is why the function exists.
Returns TRUE if var exists; FALSE otherwise.
Try something like the following:
<?php
$yespe = $_REQUEST['yespending']
if (isset($yespe)) {
echo "value=/"Requested/"";
} else {
echo "value=/"Pending/"";
}
?>