Re: HTTP_POST
| From: | Richard Lynch | Date: | Thu, 18 Jan 2001 06:36:37 +0000 |
| Subject: | Re: HTTP_POST | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35279@lists.php.net to get a copy of this message | ||
> <td><input type="checkbox" name="<?php echo$SkyAccNo;?>"
> value="ON"></td>
>
>For example there will be three rows with different values and each
checkbox will have a unique name.
>On the next page once a submit button has been pushed I want to do:
>sqlExecute( "Select * from SkyDiary where AccNo = (Here I want the value of
the checkbox)
>
>Do I use HTTP_POST_VARS here and if so how??
You could do it that way...
But it would be way more easier to do more like this:
<INPUT TYPE=CHECKBOX NAME=account[] VALUE="<?php echo $SkyAccNo;?>">
Then, in your receiving script:
$accnos = implode(', ', $account);
sqlExecute("select * from skydiary where accno in ($accnos)");
Note the use of IN and () within the SQL.
Assumption: The account numbers are integers. If not, you'll need to use
more like this:
$accnos = implode("', '", $account);
... where accno in ('$accnos')");
The point being that you need to wrap '' around each non-integer datum for
SQL.