how to create a check vote box poll with php scripts and html ???
plx someone help me!!

Recommended Answers

All 4 Replies

You'll probably have to be more specific, and posting your code is what is normally needed.

If you mean, how do you write an HTML with radio buttons and the PHP to read it, I'm going to put it all in one file here to make it easier.


if ($_POST['submit'])
 echo "You chose $value";

<form action="poll.php" method="post">
Vote for your favorite<br />
<input type="radio" name="result" value="Ford" /> Ford<br />
<input type="radio" name="result" value="Chevy" /> Chevy<br />
<input type="radio" name="result" value="Dodge" /> Dodge<br />
<input type="radio" name="result" value="Toyota" /> Toyota<br />
<input type="radio" name="result" value="Honda" /> Honda<br />
<input type="radio" name="result" value="Nissan" /> Nissan<br />
<input type='submit' name='submit' value='Vote' />

You can paste this code into a file between the <body> and </body> tags and it should(unless I forgot something) display a list of makes of car, click on Vote and it should show you your choice.

Modify to your hearts content. :)

Also check out:

i want to a PHP function that the results should come to my email address.. :) 12 check box will be there and maximum 5 should be selected..!! Actually it is a v simple vote poll which i want to make very soon. any ways thankx for the reply!! I am again hoping for a fast and good favorable solution. Please help me soon coxx i'm just new in HTML and PHP.

Some helpful hints when working with HTML checkboxes and PHP.

1. Name the checkbox entries the same and add brackets to the end of the name. This will result in all the selections being stored into an array when submitted to php.
2. If zero entries are selected, the form field is not passed at all. Your script must test for this.
Figure 1: A simple form full of check boxes of the same name.

<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>What are your favorite colors?</p>
<label><input type="checkbox" name="favoriteColor[]" value="red">Red</label>
<label><input type="checkbox" name="favoriteColor[]" value="orange">Orange</label>
<label><input type="checkbox" name="favoriteColor[]" value="yellow">Yellow</label>
<label><input type="checkbox" name="favoriteColor[]" value="green">Green</label>
<label><input type="checkbox" name="favoriteColor[]" value="blue">Blue</label>
<label><input type="checkbox" name="favoriteColor[]" value="indigo">Indigo</label>
<label><input type="checkbox" name="favoriteColor[]" value="violet">Violet</label>
<!-- other form fields here. -->
<input type='submit' name='submit' value='Vote' />

PHP will treat that as an array called $_POST.

Figure 2: PHP handler snippet for the form in figure 1.

if(isset($_POST['favoriteColor']) && count($_POST['favoriteColor']))
	$validColors = array('red','orange','yellow','green','blue','indigo','violet');
	$countColors = 0;
	foreach($_POST['favoriteColor'] as $color)
		if(in_array($color, $validColors)) {
			// do something with received values.
		} else {
			echo "The color '$color' is not a valid option.  Ignoring.";
	if($countColors > 0) {
		// send email or something when done.

Hello guys,
I am looking to create a poll in WordPress using HTML code.
I found many usufull into on the web, but i have a problem with undestanding how to put answer keys side-by-side?

I wamned it to look like this :

Far Cry 5

Yey! (button) Nay! (button) .. if possible Click to buy (button)

Thankank you a ton!

Be a part of the DaniWeb community

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