Hi,
I am new to this forum and hope someone able to help me out. My codes below is working well but with multiple selctions, it only insert the last one of list selected into a field database (with VARCHARS). Example: What I want is that the user can multiple selections the jobs that they are looking for and it will insert all what they have selected into a field. Then I can search up a keyword that match what they have selects from the database.
Also I have followed the manual for multiple selects that it will insert the lists you selected into HTML page. But I couldn't get it work with database using foreach function!
I hope I have explained clearly and sorry if my English is not too good as I communicate in signs language!
Thanks in advance!
Toby
😕
[code=php]
<?php
if ($HTTP_POST_VARS) {
MYSQL_CONNECT("localhost","root","password");
mysql_select_db("book_db");
$first = $HTTP_POST_VARS['first'];
$surname = $HTTP_POST_VARS['surname'];
$email = $HTTP_POST_VARS['email'];
$telephone = $HTTP_POST_VARS['telephone'];
$profession = $HTTP_POST_VARS['profession'];
foreach ($HTTP_POST_VARS['position'] as $value);
//$form_data = $HTTP_POST_FILES['hospnow_resume'];
$form_data_type = $FILES['userfile']['type'];
$form_data_name = $FILES['userfile']['name'];
$form_data_size = $FILES['userfile']['size'];
$data = addslashes(fread(fopen($FILES['userfile']['tmp_name'], "r"), filesize($_FILES['userfile']['tmp_name'])));
$result=MYSQL_QUERY("INSERT INTO hospnow_resume (first,surname,email,telephone,profession,occupation,bin_data,filename,filesize,filetype) ".
"VALUES ('$first','$surname','$email','$telephone','$profession','$value','$data','$form_data_name','$form_data_size','$form_data_type')");
print "<p>Thank you. Your resume has been submitted to our database.</b>";
MYSQL_CLOSE();
} else {
?> [/code]
<select name="position[]" size="9" multiple id="position">
<option>CEO</option>
<option>Regional Manager</option>
<option>Director of Sales and Marketing</option>
<option>Director of Human Resources</option>
<option>Director of Technical Support</option>
<option>Director of Finance</option>
<option>General Manager</option>
<option>Executive Assistant Manager</option>
<option>Other</option>