Jump to content

poll with database


joeyvewijck

Recommended Posts

hi,

 

i have to make a school project for school and i have to make a poll system where you can choose between 50 bands.

 

but i dont know how,

 

the task is that i have a first vote then that vote gets 10 points then you click on send then the site comes back for the second vote for 6 points and the same for the 3rd vote for 3 points.

 

this is what i have so far

<?php include 'database.php';?>
<body>

<fieldset>

	<legend>What is your favorite Band?</legend>
	
	<form action="" id="form1" name="form1" method="POST">
		
		Email:<br>
		<input type="text" name="Email" id="Email"></br></br>
		
		
		
			    Keuze 1:<br/>
				
							<?php echo '<select name="vote">';
								  echo '<option>Kies een band</option>';
                                                                                                                                                            
							$sql="SELECT * FROM bands ORDER BY band";
							$result = mysqli_query($db_link, $sql);
                                                                             
					if (!$result){
                            die ("Database connection failed!");
                        }
                                                                             
							while($row = mysqli_fetch_assoc($result)){                                                                                         
							echo '<option value="' . $row['band_id'] . '">' . $row['band'] . '</option>';
						}
                                                                             
							echo '</select>';
                 ?>  <br/>
				 
	<?php

// keuze 1

/*$teller = 1; 

while($teller <4) {
    
   
} */



	


// email opslaan 
	if (isset($_POST['submit'])){
					$email = mysqli_real_escape_string($db_link, $_POST['Email']);
					
								   $stmt2 = mysqli_prepare($db_link, "INSERT INTO stemmers (stem_id, email) VALUES (NULL, ?)");
								   mysqli_stmt_bind_param($stmt2, "s", $email);
								   mysqli_stmt_execute($stmt2);
	}							   
	?>
    <input type="submit" name="submit" id="submit" value="Vote" />

</form>

</fieldset>

</body>
Edited by joeyvewijck
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...