ben1390
03-10-2010, 11:39 AM
Hi All, I have this form with checkboxes, and would like the values of all the checkboxes ticked to be interted into a single field into the database, however it does not do this correctly, can anyone see where I am going wrong with this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Market Research</title>
</head>
<body>
<form method="post" action="process.php">
<p>Please indicate which industrial sector you conduct business within:</p>
<input type="radio" name="1" value="Primary" />Primary<br />
<input type="radio" name="1" value="Secondary" />Secondary<br />
<input type="radio" name="1" value="Tertiary" />Tertiary<br />
<input type="radio" name="1" value="Quaternary" />Quaternary
<p>1) On a scale of 1 to 5, how much do you value your website as a business asset?</p>
<input type="radio" name="2" value="1" />1
<input type="radio" name="2" value="2" />2
<input type="radio" name="2" value="3" />3
<input type="radio" name="2" value="4" />4
<input type="radio" name="2" value="5" />5
<p>2) On a scale of 1 to 5, how well do you understand the role of your company's website?</p>
<input type="radio" name="3" value="1" />1
<input type="radio" name="3" value="2" />2
<input type="radio" name="3" value="3" />3
<input type="radio" name="3" value="4" />4
<input type="radio" name="3" value="5" />5
<p>3) Do you create, plan and execute a strategically thought out marketing plan for your company at least once a year?</p>
<input type="radio" name="4" value="Yes" />Yes
<input type="radio" name="4" value="No" />No
<p>4) On a scale of 1 to 5, how much business do you think your website generates for you?</p>
<input type="radio" name="5" value="1" />1
<input type="radio" name="5" value="2" />2
<input type="radio" name="5" value="3" />3
<input type="radio" name="5" value="4" />4
<input type="radio" name="5" value="5" />5
<p>5) Which of the following do you think should be your websites number one task?</p>
<input type="radio" name="6" value="To act as an accurate visual presentation of your company" />To act as an accurate visual presentation of your company<br />
<input type="radio" name="6" value="Attract as many new leads as possible" />Attract as many new leads as possible<br />
<input type="radio" name="6" value="Inform your target market of the servies/products you offer" />Inform your target market of the servies/products you offer
<p>6) On a scale of 1 to 5, how relevant to your business do you think Search Engine Optimisation will become in the next 12 months?</p>
<input type="radio" name="7" value="1" />1
<input type="radio" name="7" value="2" />2
<input type="radio" name="7" value="3" />3
<input type="radio" name="7" value="4" />4
<input type="radio" name="7" value="5" />5
<p>7) On a scale of 1 to 5, how relavent to your business' success will your website be during the next 12 months?</p>
<input type="radio" name="8" value="1" />1
<input type="radio" name="8" value="2" />2
<input type="radio" name="8" value="3" />3
<input type="radio" name="8" value="4" />4
<input type="radio" name="8" value="5" />5
<p>8) Please indicate which products below you think you would most benefit from:</p>
<input type="radio" name="9" value="Search Engine Optimisation" />Search Engine Optimisation<br />
<input type="radio" name="9" value="A complete new website" />A complete new website<br />
<input type="radio" name="9" value="Consultancy on how to better use your online presence" />Consultancy on how to better use your online presence<br />
<input type="radio" name="9" value="Consultancy on Search Engine Optimisation and Internet Marketing" />Consultancy on Search Engine Optimisation and Internet Marketing
<p>9) On a scale of 1 to 5, to what degree would you say you understand the term "digital marketing"?</p>
<input type="radio" name="10" value="1" />1
<input type="radio" name="10" value="2" />2
<input type="radio" name="10" value="3" />3
<input type="radio" name="10" value="4" />4
<input type="radio" name="10" value="5" />5
<p>10) Please indicate, by ticking the appropriate boxes, the elements you think that makes a strong web design firm:</p>
<input type="checkbox" name="11[]" value="Strong portfolio" />Strong portfolio<br />
<input type="checkbox" name="11[]" value="Wide range of services" />Wide range of services<br />
<input type="checkbox" name="11[]" value="Rapid turnaround of projects" />Rapid turnaround of projects<br />
<input type="checkbox" name="11[]" value="Design awards for their websites" />Design awards for their websites<br />
<input type="checkbox" name="11[]" value="Revavant accreditations and awards" />Revavant accreditations and awards<br />
<input type="checkbox" name="11[]" value="Evidence of results" />Evidence of results<br />
<input type="checkbox" name="11[]" value="Frequent communication with you" />Frequent communication with you<br />
<input type="checkbox" name="11[]" value="Strong differentiation from completion" />Strong differentiation from completion
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
</body>
</html><?php
$connection = mysql_connect("localhost","username","password") or die ('Could not connect: ' . mysql_error());
$question1 = $_POST['1'];
$question2 = $_POST['2'];
$question3 = $_POST['3'];
$question4 = $_POST['4'];
$question5 = $_POST['5'];
$question6 = $_POST['6'];
$question7 = $_POST['7'];
$question8 = $_POST['8'];
$question9 = $_POST['9'];
$question10 = $_POST['10'];
$question11 = serialize($_POST['11']);
mysql_select_db("database_name", $connection);
mysql_query("INSERT INTO entries (question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11) VALUES ('$question1', '$question2', '$question3', '$question4', '$question5', '$question6', '$question7', '$question8', '$question9', '$question10', '$question11')");
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Market Research</title>
</head>
<body>
<form method="post" action="process.php">
<p>Please indicate which industrial sector you conduct business within:</p>
<input type="radio" name="1" value="Primary" />Primary<br />
<input type="radio" name="1" value="Secondary" />Secondary<br />
<input type="radio" name="1" value="Tertiary" />Tertiary<br />
<input type="radio" name="1" value="Quaternary" />Quaternary
<p>1) On a scale of 1 to 5, how much do you value your website as a business asset?</p>
<input type="radio" name="2" value="1" />1
<input type="radio" name="2" value="2" />2
<input type="radio" name="2" value="3" />3
<input type="radio" name="2" value="4" />4
<input type="radio" name="2" value="5" />5
<p>2) On a scale of 1 to 5, how well do you understand the role of your company's website?</p>
<input type="radio" name="3" value="1" />1
<input type="radio" name="3" value="2" />2
<input type="radio" name="3" value="3" />3
<input type="radio" name="3" value="4" />4
<input type="radio" name="3" value="5" />5
<p>3) Do you create, plan and execute a strategically thought out marketing plan for your company at least once a year?</p>
<input type="radio" name="4" value="Yes" />Yes
<input type="radio" name="4" value="No" />No
<p>4) On a scale of 1 to 5, how much business do you think your website generates for you?</p>
<input type="radio" name="5" value="1" />1
<input type="radio" name="5" value="2" />2
<input type="radio" name="5" value="3" />3
<input type="radio" name="5" value="4" />4
<input type="radio" name="5" value="5" />5
<p>5) Which of the following do you think should be your websites number one task?</p>
<input type="radio" name="6" value="To act as an accurate visual presentation of your company" />To act as an accurate visual presentation of your company<br />
<input type="radio" name="6" value="Attract as many new leads as possible" />Attract as many new leads as possible<br />
<input type="radio" name="6" value="Inform your target market of the servies/products you offer" />Inform your target market of the servies/products you offer
<p>6) On a scale of 1 to 5, how relevant to your business do you think Search Engine Optimisation will become in the next 12 months?</p>
<input type="radio" name="7" value="1" />1
<input type="radio" name="7" value="2" />2
<input type="radio" name="7" value="3" />3
<input type="radio" name="7" value="4" />4
<input type="radio" name="7" value="5" />5
<p>7) On a scale of 1 to 5, how relavent to your business' success will your website be during the next 12 months?</p>
<input type="radio" name="8" value="1" />1
<input type="radio" name="8" value="2" />2
<input type="radio" name="8" value="3" />3
<input type="radio" name="8" value="4" />4
<input type="radio" name="8" value="5" />5
<p>8) Please indicate which products below you think you would most benefit from:</p>
<input type="radio" name="9" value="Search Engine Optimisation" />Search Engine Optimisation<br />
<input type="radio" name="9" value="A complete new website" />A complete new website<br />
<input type="radio" name="9" value="Consultancy on how to better use your online presence" />Consultancy on how to better use your online presence<br />
<input type="radio" name="9" value="Consultancy on Search Engine Optimisation and Internet Marketing" />Consultancy on Search Engine Optimisation and Internet Marketing
<p>9) On a scale of 1 to 5, to what degree would you say you understand the term "digital marketing"?</p>
<input type="radio" name="10" value="1" />1
<input type="radio" name="10" value="2" />2
<input type="radio" name="10" value="3" />3
<input type="radio" name="10" value="4" />4
<input type="radio" name="10" value="5" />5
<p>10) Please indicate, by ticking the appropriate boxes, the elements you think that makes a strong web design firm:</p>
<input type="checkbox" name="11[]" value="Strong portfolio" />Strong portfolio<br />
<input type="checkbox" name="11[]" value="Wide range of services" />Wide range of services<br />
<input type="checkbox" name="11[]" value="Rapid turnaround of projects" />Rapid turnaround of projects<br />
<input type="checkbox" name="11[]" value="Design awards for their websites" />Design awards for their websites<br />
<input type="checkbox" name="11[]" value="Revavant accreditations and awards" />Revavant accreditations and awards<br />
<input type="checkbox" name="11[]" value="Evidence of results" />Evidence of results<br />
<input type="checkbox" name="11[]" value="Frequent communication with you" />Frequent communication with you<br />
<input type="checkbox" name="11[]" value="Strong differentiation from completion" />Strong differentiation from completion
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
</body>
</html><?php
$connection = mysql_connect("localhost","username","password") or die ('Could not connect: ' . mysql_error());
$question1 = $_POST['1'];
$question2 = $_POST['2'];
$question3 = $_POST['3'];
$question4 = $_POST['4'];
$question5 = $_POST['5'];
$question6 = $_POST['6'];
$question7 = $_POST['7'];
$question8 = $_POST['8'];
$question9 = $_POST['9'];
$question10 = $_POST['10'];
$question11 = serialize($_POST['11']);
mysql_select_db("database_name", $connection);
mysql_query("INSERT INTO entries (question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11) VALUES ('$question1', '$question2', '$question3', '$question4', '$question5', '$question6', '$question7', '$question8', '$question9', '$question10', '$question11')");
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";
?>