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

From: Date: Tue, 08 Jul 2008 00:11:52 +0000
Subject: Re: Question before I end up writing alot of extra code...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-276423@lists.php.net to get a copy of this message
> 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/

« previous php.general (#276423) next »