The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Process multiple checkboxes into a Database
I'm making a survey and I have 3 questions that can have multiple choices selected. But when I submit the survey, only the last one selected in each question's item chosen gets stored in the database. I tried figuring this out on my own all day and my brain is so fried. Any help or leads would be greatly appreciated. Thanks.
|
#2
|
|||
|
|||
add [] to the field name in your form.... just as if you were building an array,
then once its submitted they are stored as an array |
#3
|
||||
|
||||
Here's what I did now.
Code:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "OrderForm")) { $value_array = $_POST['intend']; foreach($value_array as $value){ $intend .= $value; } $value_array = $_POST['favorlook']; foreach($value_array as $value){ $favorlook .= $value; } $value_array = $_POST['elements']; foreach($value_array as $value){ $elements .= $value; } $insertSQL = sprintf("INSERT INTO orders (customer, company, address, city, `state`, zip, phone, email, `desc`, industry, cosize, `domain`, top1, top2, top3, hosting, HosCom, HosName, HosPhone, HosEmail, wanthost, redesign, budget, logo, nologo, market, target, pages, NetKnow, intend, favorlook, commerce, Site1, Why1, Site2, Why2, Site3, Why3, Site4, Why4, content, elements, updating, keywords, timeframe, findus, addinfo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['customer'], "text"), GetSQLValueString($_POST['company'], "text"), GetSQLValueString($_POST['address'], "text"), GetSQLValueString($_POST['city'], "text"), GetSQLValueString($_POST['state'], "text"), GetSQLValueString($_POST['zip'], "text"), GetSQLValueString($_POST['phone'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['desc'], "text"), GetSQLValueString($_POST['industry'], "text"), GetSQLValueString($_POST['cosize'], "text"), GetSQLValueString($_POST['domain'], "text"), GetSQLValueString($_POST['top1'], "text"), GetSQLValueString($_POST['top2'], "text"), GetSQLValueString($_POST['top3'], "text"), GetSQLValueString($_POST['hosting'], "text"), GetSQLValueString($_POST['HosCom'], "text"), GetSQLValueString($_POST['HosName'], "text"), GetSQLValueString($_POST['HosPhone'], "text"), GetSQLValueString($_POST['HosEmail'], "text"), GetSQLValueString($_POST['wanthost'], "text"), GetSQLValueString($_POST['redesign'], "text"), GetSQLValueString($_POST['budget'], "text"), GetSQLValueString($_POST['logo'], "text"), GetSQLValueString($_POST['nologo'], "text"), GetSQLValueString($_POST['market'], "text"), GetSQLValueString($_POST['target'], "text"), GetSQLValueString($_POST['pages'], "text"), GetSQLValueString($_POST['NetKnow'], "text"), GetSQLValueString($intend, "text"), GetSQLValueString($favorlook, "text"), GetSQLValueString($_POST['commerce'], "text"), GetSQLValueString($_POST['Site1'], "text"), GetSQLValueString($_POST['Why1'], "text"), GetSQLValueString($_POST['Site2'], "text"), GetSQLValueString($_POST['Why2'], "text"), GetSQLValueString($_POST['Site3'], "text"), GetSQLValueString($_POST['Why3'], "text"), GetSQLValueString($_POST['Site4'], "text"), GetSQLValueString($_POST['Why4'], "text"), GetSQLValueString($_POST['content'], "text"), GetSQLValueString($elements, "text"), GetSQLValueString($_POST['updating'], "text"), GetSQLValueString($_POST['keywords'], "text"), GetSQLValueString($_POST['timeframe'], "text"), GetSQLValueString($_POST['findus'], "text"), GetSQLValueString($_POST['addinfo'], "text")); Here's an image. For some reason, I get the word "Array". Anyway I can get that out? |
#4
|
||||
|
||||
matthepepe, I tried what you said, and it only gave me the word array. Help?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|