Re: Question before I end up writing alot of extra code...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Here is a VERY simplified test :)
> MAIN PAGE:
> <?PHP
> if($row['Tab'] == "done"){
>     $Tchecked1 = "CHECKED";
>     $Tchecked2 = NULL;
> }else{
>     $Tchecked1 = NULL;
>     $Tchecked2 = "CHECKED";
> }
> 
> echo"
> <fieldset>Tab<BR>
> <input type="radio" name="rdoTab" value="done" $Tchecked1>Done <BR>
> <input type="radio" name="rdoTab" value="on" $Tchecked2>Not Done<BR>
> </fieldset>";
> ?>
> PROCESSING:
> <?PHP
>                 $tab = $_POST['rdoTab'];
>                 $record = $_POST['txtRecord'];
>                 $updateQuery = "UPDATE `current` SET Tab='$tab'  WHERE
> Record='$record'";
>                
> mysqli_real_query($link, $updateQuery);   

Checkboxes and radio buttons only post back the values for the ones
selected.

If you have:

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" name="ids[]" value="1">Option 1<br/>
<input type="checkbox" name="ids[]" value="2">Option 2<br/>
<input type="checkbox" name="ids[]" value="3">Option 3<br/>
</form>

view that, and tick options 1 and 3, only they will be available in $_POST.

This has not changed in any version of php, it has always been this way
- and it will be exactly the same in perl, python, ruby and any other
language.

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux