Hi, I'm trying to insert some values to database based on how many values are clicked but currently it only takes the last clicked field. I have tried hard coding with mysql_real_escape_string and the dreamweaver way. Both still give me the same last picked value instead of several values separated by a comma. Here's an example of my code: if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "worder")) { $insertSQL = sprintf("INSERT INTO tblwork_order (veh_plateno, worList, worDesc, price, expcompDate, st_username) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['pno'], "text"), GetSQLValueString($_POST['pat1'], "text"), GetSQLValueString($_POST['or'], "text"), GetSQLValueString($_POST['worprice'], "text"), GetSQLValueString($_POST['sdate'], "text"), GetSQLValueString($_POST['stname'], "text")); mysql_select_db($database_localhost, $localhost); $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error()); $insertGoTo = "techdb.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } <label>Parts to be worked on</label> <select multiple class="form-control" id="pat1" name="pat1[]" required> <option id="def" value="default" selected="selected">--Select--</option> do { ?> <option value="" data-price=""></option> } while ($row_services = mysql_fetch_assoc($services)); $rows = mysql_num_rows($services); if($rows > 0) { mysql_data_seek($services, 0); $row_services = mysql_fetch_assoc($services); } ?> </select> Any help to achieve this would be greatly appreciated. Thanks in advance
ogo' 0
Newbie Poster
Recommended Answers
Jump to PostAlthough we value contributions, adding a solution to a dead thread and using out of date code (mysql functions) is not very helpful. Dreamweaver needs to die a horrible death too.
All 3 Replies
TexWiller 0
Newbie Poster
Mayank_6 0
Newbie Poster
diafol
rproffitt
commented:
Thanks, I didn't think of that (dying dreams.) +11
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.