By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,684 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Multiple select issue

P: 1
Hi, i would sen multiple select to mysql by form, my prb is:
[php]
file connect.php

<?php
$user="sundsx";
$pass="password";
$db="testphp";
$val_form=$_POST['val_form'];
$service =$_POST['service'];

mysql_connect(localhost,$user,$pass);
@mysql_select_db($db) or die( "Can't connect to db now");
$query = "INSERT INTO multi VALUES ('','$_POST[val_form]','$_POST[service]')";
mysql_query($query);
mysql_close();
?>

file insert.php

!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=ISO-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>

<form action="connect.php" method="post">
<select name="val_form[]" size="4" multiple>
<option value="colloqio" >colloqio</option>
<option value="questionari chiusi" >questionari chiusi</option>
<option value="questionari aperti" >questionari aperti</option>
<option value="tesina-project work" >tesina-project work</option>
</select>
<br>
<select name="service[]" size="4" multiple>
<option value="patrocinio" >Patrocinio</option>
<option value="progettazione" >Progettazione</option>
<option value="valutazione" >Valutazione</option>
<option value="docenti" >Docenti</option>
</select>
<br>
<input type="submit" value="Insert record">
</form>

</body>
</html>[/php]

was send on mysl:

ID Val_form service
20 Array Array

some help please?

Read the Posting Guidelines at the top of this forum before you continue!
Especially the part about enclosing code within php or code tags!!

moderator
Feb 28 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.