the_mia_team 0 Newbie Poster

http://getagripsite.com/level_one.html

that is a link to my site, an application I am working on. If you visit that site you will see an option 1, option 2, and option 3, as well as a bonus option

IF the checkbox is selected it is worth points, and the bonus can ONLY be selected if option 1, 2, and 3 are selected

option 1, 2, 3 are all worth 20 points
bonus is worth 40

so if all together selected would output points of 100

here is the coding I wrote for that section there but I can't get it to work correctly, first off I can't get them to add up and then submit to my database, second off how to I make the score output into the textbox I have shown on the page?

obviously i deleted the username and password from my script here

<?php // Connects to your Database 
 mysql_connect("", "", "") or die(mysql_error()); 
 mysql_select_db("") or die(mysql_error()); 
 //This code runs if the form has been submitted
 if (isset($_POST['submit'])) 
 
// now we insert it into the database
 	$insert = "INSERT INTO Scores (Score1)
 			VALUES ('".$_POST['Score1']."')";
 	$add_member = mysql_query($insert);


$point = 0;
$levels = array();

if (isset($_POST['level_one_option_one']) &&
$_POST['level_one_option_one'] == 'lev1_op1') {
	// Code if checked
	$point += 20;

	$levels[] = 1; // append level 1
}

if (isset($_POST['level_one_option_two']) &&
$_POST['level_one_option_three'] == 'lev1_op2') {
	// Code if checked
	$point += 20;
	$levels[] = 2; // append to an array
}

if (isset($_POST['level_one_option_three']) &&
$_POST['level_one_option_three'] == 'lev1_op3') {
	// Code if checked
	$point += 20;

	$levels[] = 3; // append level 3
}

if (count($levels) < 3 && isset($_POST['level_one_bonus'])) {
	// No enought point to check the bonus code
	echo 'No way!';
	exit();
}

if (isset($_POST['level_one_bonus']) &&
$_POST['level_one_bonus'] == 'lev1_bonus') {
	// Code if checked
	$point += 40;

	$levels[] = 4; // append level 4
}

?>

 <form action="" method="post">
    <input type="submit" name="register" value="Submit Score">
 </form><br>
Your Score is:<form action="">
<input type="register" name="">
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.