Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Izzyg33 #1
php - sticky form checkbox problem
I'm trying to make a form so that when the user submits it, a php script
validates the form and if there is anything wrong with any of the data entered
and the form re-loads, the values entered by the user are put back into the
form field for the user to see. For example; <input name='password2'
type='password' id='password2' class='form_verd' <?print 'value='$password2''
;?> > This works fine with textboxes as above but with checkboxes I am
having problems because I want the box to be checked if it was previously
checked and unchecked if it was previously unchecked but it is the value that
is passed from page to page i.e. 'true', not whether the box was checked or
not. <input name='agree' type='checkbox' id='agree' class='form_verd'
value='true' checked=yes> so if I write something along the lines of if
($value == true){ checked = yes;} else{ checked = no;} this doesn't work
because even when the page loads initially before being submitted, the php
reads the value as true so the box is always checked Does anyone know of a way
round this?:confused;
Izzyg33 Guest
-
How do I use the form checkbox value?
I'm creating a form that has multiple checkboxes. I want to use ActionScript to update a text box/area with the values each checkbox as the checkbox... -
Flash Form & Checkbox
I'm having trouble changing this listbox code to checkboxes instead. Can you help? <cfselect name="binderyID" label = "Bindery Type"... -
Checkbox value in MX7 Flash Form
I am testing multi-tab forms in MX7 using the last example from the HTML documentation for the cfformgroup tag. The cfdump just shows whether each... -
Checkbox Set To OFF Not In Request.Form
When using checkboxes on a form, if you uncheck them, the unchecked name/value pair in the Request.Form collection doesn't show up. It only shows... -
Yes/No checkbox in the form
I have a field called action in a table, to check if something requires action the user must check the box. The field in the table is defined as a... -
Joseph Szobody #2
Re: php - sticky form checkbox problem
Try this:
<input name='agree' type='checkbox' id='agree' class='form_verd'
value='true' <?php if($_POST['agree'] == 'true') echo "checked" ?>>
Joseph
"Izzyg33" <webforumsuser@macromedia.com> wrote in message
news:cvkrci$miq$1@forums.macromedia.com...> I'm trying to make a form so that when the user submits it, a php script
> validates the form and if there is anything wrong with any of the data
> entered
> and the form re-loads, the values entered by the user are put back into
> the
> form field for the user to see. For example; <input name='password2'
> type='password' id='password2' class='form_verd' <?print
> 'value='$password2''
> ;?> > This works fine with textboxes as above but with checkboxes I am
> having problems because I want the box to be checked if it was previously
> checked and unchecked if it was previously unchecked but it is the value
> that
> is passed from page to page i.e. 'true', not whether the box was checked
> or
> not. <input name='agree' type='checkbox' id='agree' class='form_verd'
> value='true' checked=yes> so if I write something along the lines of if
> ($value == true){ checked = yes;} else{ checked = no;} this doesn't
> work
> because even when the page loads initially before being submitted, the php
> reads the value as true so the box is always checked Does anyone know of
> a way
> round this?:confused;
>
Joseph Szobody Guest
-



Reply With Quote

