₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,020 members, 8,419,966 topics. Date: Thursday, 04 June 2026 at 08:28 AM

Toggle theme

What's Wrong With This Code? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingWhat's Wrong With This Code? (1191 Views)

1 Reply (Go Down)

What's Wrong With This Code? by ify01(op): 1:06pm On Mar 09, 2017
Please can someone figure out the problem with this code? it just keeps displaying errors.

<html>
<head>
<?php
$ch1 = " unchecked";
$ch2 = "unchecked";
$ch3 = "unchecked";
$ch4 = "unchecked";
$ch5 = "unchecked";
if (isset($_POST["submit1"]))
{
if (isset($_POST["ch1"]))
{
$ch1 = $_POST["ch1"];
if ($ch1 == "word"wink
{$ch1 = "checked";}
}

if (isset($_POST["ch2"]))
{
$ch2 = $_POST["ch2"];
if ($ch2 == "key"wink
{$ch2 = "checked";}
}
if (isset($_POST["ch3"]))
{
$ch3 = $_POST["ch3"];
if ($ch3 == "excel"wink
{$ch3 = "checked;}
}
if (isset($_POST["ch4"]))
{
$ch4 = $_POST["ch4"];
if ($ch4 == "corel"wink
{$ch4 = "checked";}
}
if (isset($_POST["ch5"]))
{
$ch5 = $_POST['ch5'];
if ($ch5 == "power"wink
{$ch5 = "checked";}
}
}

?>
</head>
<body>
<form name = "form1" method = "post" action = "checkbox.php">
<input type = "Checkbox" name = "ch1" value = "word" <?php print $ch1; ?> >Msword
<P>
<input type = "Checkbox" name = "ch2" value = "key" <?php print $ch2; ?> >Passkey
<P>
<input type = "Checkbox" name = "ch3" value = "excel" <?php print $ch3; ?> >Excel
<P>
<input type = "Checkbox" name = "ch4" value = "corel" <?php print $ch4; ?> >Coreldraw
<P>
<input type = " Checkbox" name = "ch5" value = "power" <?php print $ch5; ?> >Powerpoint
<P>
<input type = "submit" name = "submit1" value = "Select your choices">
</form>
</body>
</html>
Re: What's Wrong With This Code? by Donald3d(m): 2:29pm On Mar 09, 2017
first of all I had a hard time reading your if statement,use switch next time.My head hurtshuh
if you dont want to use switch just use AND/OR to combine all of them
In your html the p tag was not closed
Also the input tag close it

Modified
Where you have $ch3="checked.......
You missed the second apostrophe.
Re: What's Wrong With This Code? by hotwax: 4:31pm On Mar 09, 2017
Your braces are killing...Use a better construct like switch...case

However, send us the error message, that can help us to help u
Re: What's Wrong With This Code? by ify01(op): 6:05pm On Mar 09, 2017
Donald3d:
first of all I had a hard time reading your if statement,use switch next time.My head hurtshuh
if you dont want to use switch just use AND/OR to combine all of them
In your html the p tag was not closed
Also the input tag close it

Modified
Where you have $ch3="checked.......
You missed the second apostrophe.
Thanks. The error was as a result of the apostrophe. you said something about switch. . . i would appreciate a sample of how I can use switch or AND/OR as per this code.
Re: What's Wrong With This Code? by ify01(op): 6:07pm On Mar 09, 2017
hotwax:
Your braces are killing...Use a better construct like switch...case

However, send us the error message, that can help us to help u
Thanks. I would appreciate if you can give me a sample of using switch . . .
1 Reply

Please,Help Explain This Code In CJava Code Pls Modify This Code HelpJava Programmers ,I Need Help Fixing This Code.234

Tips To Create The Most Amazing Iphone Apps For Your BusinessGoogle Startup StorySeun Unflag W.A.P.K.A Dot M0BI Domain On Nairaland