Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluating a checkbox value 1

Status
Not open for further replies.

arlequin

Programmer
Sep 21, 1999
232
UY
Hello, there.

I must select 1 or 0 according to a checked and/or unchecked checkbox.

The HTML holding the form is the following:
Code:
<form name=&quot;frm_cli&quot; action=&quot;save_cli.php&quot; method=&quot;POST&quot;>
  . . . . .
  . . . . .
  <input type=&quot;checkbox&quot; name=&quot;cli_manuf&quot; value=&quot;checkbox&quot;>
  . . . . .
  . . . . .
</form>

... and then, in
Code:
save_cli.php
I have the following:

Code:
if ($cli_manuf) {
   $manuf=1;
else {
   $manuf=0;
}

...in order to set $manuf to 1 or 0 whether the checkbox is enabled or not.

But the PHP interpreter says
Parse error: parse error in /var/ on line 29


Line 29 is
Code:
else {

What the problem is?
I can't figure out where the error is.
Perhaps that kind of if...else is not the best way to ask for a checkbox value...

Thanks in advance Arlequín
arlequin@montevideo.com.uy
 
Thanks for replying, sleipnir214.

I must go home, take a shower and go to bed... ;-)


I was mssing the { Arlequín
arlequin@montevideo.com.uy
 
NOOOOOO


the closing parenthesis }

Arlequín
arlequin@montevideo.com.uy
 
&quot;Parse error: parse error in <filename> on line <line number>&quot; is what the PHP interpreter says. What it means is: &quot;I'm confused, and I realized I had gotten confused about the time I was reading line <line number> in file <filename>&quot;

With that error, always start from the offending line and work your way backwords looking for stupid typographical errors. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top