Request for clarification of a doubt
| From: | Raghuram | Date: | Fri, 14 Apr 2000 00:57:34 +0000 |
| Subject: | Request for clarification of a doubt | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17905@lists.php.net to get a copy of this message | ||
Hello Sir,
I'm doing a project for a concern. I'm using PHP3 for server-side
scripting and MySQL as the database.I have faced a problem while working
in this. I'm using a control Option with Multiple selection (which acts
as a List Box Control) in my page. I'm trying to insert more than one
selected value. But only the last selected value is getting inserted
into the table. Multiple values are not inserted. I'm herewith sending
my php code:
<html>
<body>
<div align="left">
<table border="0" width="75%">
</tr>
<?php
if ($continue)
{
$db = mysql_connect();
mysql_select_db("mydb",$db);
$sql="INSERT INTO compdet (companyname,busstype) VALUES
('$compname','$busstype')";
$result = mysql_query($sql);
echo "Thankyou<br>\n";
}
else
{
// display form ?>
<form action="<?php echo $PHP_SELF?>" method="POST">
<tr>
<td width="365" height="21">Company Name :</td>
<td width="253" height="21"><input name="compname"
type="text"
size="20"></td>
</tr>
<tr>
<td width="365" height="21">Business
Type :</td>
<td width="253" height="21"><select name="busstype"
size="4"
multiple>
<option value="Importer">Importer</option>
<option value="Exporter">Exporter</option>
<option value="Manufacturer">Manufacturer</option>
<option value="Supplier">Supplier</option>
</select></td>
</tr>
<tr>
<td width="365" height="21"></td>
<td width="253" height="21"><input type="submit"
value="continue"
name="continue"><input
type="reset" value="Reset" name="Reset"></td>
</tr>
</form>
<?php } // end if ?>
</tr>
</table>
</div>
</body>
</html>
In the above code, i have tried to insert Importer, Exporter, and
Supplier in to the table called "compdet", but only Manufacturer is
getting inserted.
waiting for your reply as soon as possible.
(Actual Question: My Actual try is to Insert multiple values seperated
by the delimiter ',' into a field called "busstype" in the table
"compdet". Also trying to write a Select Query to select the companies
from the following list such as Importers, Exporters, Manufacturers or
Suppliers. )
if possible, send me the source code. Otherwise, try to say a better
solution.
Regards
Raghuram.