Forums

This topic is locked

simple poll

Posted 25 Oct 2007 19:12:03
1
has voted
25 Oct 2007 19:12:03 Karen Faris posted:
I am trying to create a simple poll for the web. I would like to create a photo album where users can vote for their favorite photo. I would like to allow only one answer and the results to go to an e-mail address. What is the easiest way.

Replies

Replied 01 Nov 2007 20:32:13
01 Nov 2007 20:32:13 john newsome replied:
looks like you need some form of script to post the result to an email address look at php mail() function just create a form that when submited sends the result to an email basic exaple below if you need help let me know

<pre id=code><font face=courier size=2 id=code>&lt;?
if ($_POST[action]){
$to = "email address"
$subject = "poll result";
$msg = $_POST[result];
$headers = "from "
mail ($to,$subject,$msg.$headers);
}
?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script language="javascript"&gt;
function show(divValue){
document.getElementById("picture".innerHTML = '&lt;img src='+divValue+' /&gt;';

}

&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;form action="" method="post" name="theform"&gt;
&lt;input type="hidden" name="action" value="1" /&gt;

&lt;input type="radio" name="result" value="radio1" /&gt;

&lt;br /&gt;

&lt;input type="radio" name="result" value="radio2" /&gt;

&lt;br /&gt;

&lt;input type="submit" value="submit" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt; </font id=code></pre id=code>

Reply to this topic