one value in one field
Moderator: General Moderators
one value in one field
How do you get more than one value in one field?
I use Dreamweaver8 and the code is very looks very complicated.
I use Dreamweaver8 and the code is very looks very complicated.
Re: one value in one field
Why do you use it?
You can use special chars (; , space etc.) to separate values, and then use the explode() function.
You can use special chars (; , space etc.) to separate values, and then use the explode() function.
Re: one value in one field
I am New to php can you give me an idea of how you use the explode() function.Ziq wrote:Why do you use it?
You can use special chars (; , space etc.) to separate values, and then use the explode() function.
what do you use when you need dynamic pages.
Re: one value in one field
Go through the manual:
http://www.php.net/manual/en/function.explode.php
http://www.php.net/manual/en/function.explode.php
Re: one value in one field
ok but is it better to have dreamweaver write php or write it yourself and save as external file to use with formpcoder wrote:Go through the manual:
http://www.php.net/manual/en/function.explode.php
Re: one value in one field
I don't see any link with subject of topic.what do you use when you need dynamic pages.
I'm never use dreamweaver and i think i'm not aloneok but is it better to have dreamweaver write php or write it yourself and save as external file to use with form
Re: one value in one field
Ziq wrote:I don't see any link with subject of topic.what do you use when you need dynamic pages.
I'm never use dreamweaver and i think i'm not aloneok but is it better to have dreamweaver write php or write it yourself and save as external file to use with form. I think better if you explain what do you want to do in detail.
OK I'll try to explain
I have created a database in mysql, this is fine and works.
I created site using Dreamweaver8, this is fine and working.
Now i need a database CMS, i have created the insert page but i need more than 1 value in one field ???????
the form send information to the DB but the code is very hard to understand. all the examples of php i have look different to the php dreamweaver writes.
Take a look and if their is any advise you can give will help.
Code: Select all
<?php require_once('Connections/DI_Directory.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "DI_Update")) {
$insertSQL = sprintf("INSERT INTO master_info (date_added, f_name, l_name, Gender, Logo_link, Instructor_pic, Instructor_Qualifacations, ADI_Number, Category_Type, business_name, address, Address2, TownAndCity, County, Business_type, Covered, zipcode, tel_number, Tel_Type, Business_No1, Business_No2, Mobile_number, Mobile_Type, fax_number, Fax_Type, website, email, email1_Type, email2, email2_Type, personal_notes, Company_info) 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)",
GetSQLValueString($_POST['Date_entered_hid'], "date"),
GetSQLValueString($_POST['FirstName'], "text"),
GetSQLValueString($_POST['SirName'], "text"),
GetSQLValueString($_POST['Gender'], "text"),
GetSQLValueString($_POST['Logo'], "text"),
GetSQLValueString($_POST['Instructor_pic'], "text"),
GetSQLValueString($_POST['InstructorQual'], "text"),
GetSQLValueString($_POST['ADI_Number'], "int"),
GetSQLValueString($_POST['Category_Type'], "text"),
GetSQLValueString($_POST['Business_Name'], "text"),
GetSQLValueString($_POST['Address1'], "text"),
GetSQLValueString($_POST['Address2'], "text"),
GetSQLValueString($_POST['Town'], "text"),
GetSQLValueString($_POST['CountyBox'], "text"),
GetSQLValueString($_POST['BusinessType'], "text"),
GetSQLValueString($_POST['AeraCovered'], "text"),
GetSQLValueString($_POST['ZipCode'], "text"),
GetSQLValueString($_POST['LandLine'], "text"),
GetSQLValueString($_POST['LandLine_Type'], "text"),
GetSQLValueString($_POST['Business_No1'], "text"),
GetSQLValueString($_POST['Business_No2'], "text"),
GetSQLValueString($_POST['MobileNumber'], "text"),
GetSQLValueString($_POST['Mobile_Type'], "text"),
GetSQLValueString($_POST['FaxNumber'], "text"),
GetSQLValueString($_POST['Fax_Type'], "text"),
GetSQLValueString($_POST['Website'], "text"),
GetSQLValueString($_POST['email1'], "text"),
GetSQLValueString($_POST['Email_Type'], "text"),
GetSQLValueString($_POST['email2'], "text"),
GetSQLValueString($_POST['Email2_Type'], "text"),
GetSQLValueString($_POST['Mobile_Type'], "text"),
GetSQLValueString($_POST['Persional_Notes'], "text"));
mysql_select_db($database_DI_Directory, $DI_Directory);
$Result1 = mysql_query($insertSQL, $DI_Directory) or die(mysql_error());
}
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Master_info = "SELECT date_added, f_name, l_name, Logo_link, Instructor_pic, Instructor_Qualifacations, ADI_Number, business_name, address, Address2, TownAndCity, County, Business_type, Listing_type, Covered, zipcode, tel_number, Tel_Type, Business_No1, Business_No2, Mobile_number, Mobile_Type, fax_number, Fax_Type, website, email, email1_Type, email2, email2_Type, personal_notes, Company_info FROM master_info";
$Master_info = mysql_query($query_Master_info, $DI_Directory) or die(mysql_error());
$row_Master_info = mysql_fetch_assoc($Master_info);
$totalRows_Master_info = mysql_num_rows($Master_info);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Business_type = "SELECT Business_type FROM business_type";
$Business_type = mysql_query($query_Business_type, $DI_Directory) or die(mysql_error());
$row_Business_type = mysql_fetch_assoc($Business_type);
$totalRows_Business_type = mysql_num_rows($Business_type);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_County = "SELECT County FROM county";
$County = mysql_query($query_County, $DI_Directory) or die(mysql_error());
$row_County = mysql_fetch_assoc($County);
$totalRows_County = mysql_num_rows($County);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Covered = "SELECT Covered FROM covered";
$Covered = mysql_query($query_Covered, $DI_Directory) or die(mysql_error());
$row_Covered = mysql_fetch_assoc($Covered);
$totalRows_Covered = mysql_num_rows($Covered);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Instructor_Qual = "SELECT Instructor_Qualifacations FROM instructor_qual";
$Instructor_Qual = mysql_query($query_Instructor_Qual, $DI_Directory) or die(mysql_error());
$row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual);
$totalRows_Instructor_Qual = mysql_num_rows($Instructor_Qual);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Listing_Type = "SELECT Listing_type FROM listing_type";
$Listing_Type = mysql_query($query_Listing_Type, $DI_Directory) or die(mysql_error());
$row_Listing_Type = mysql_fetch_assoc($Listing_Type);
$totalRows_Listing_Type = mysql_num_rows($Listing_Type);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Contact_Type = "SELECT Contact_Type FROM contact_type";
$Contact_Type = mysql_query($query_Contact_Type, $DI_Directory) or die(mysql_error());
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
$totalRows_Contact_Type = mysql_num_rows($Contact_Type);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Category_Type = "SELECT Category_Type FROM category_type";
$Category_Type = mysql_query($query_Category_Type, $DI_Directory) or die(mysql_error());
$row_Category_Type = mysql_fetch_assoc($Category_Type);
$totalRows_Category_Type = mysql_num_rows($Category_Type);
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Gender = "SELECT Gender FROM gender";
$Gender = mysql_query($query_Gender, $DI_Directory) or die(mysql_error());
$row_Gender = mysql_fetch_assoc($Gender);
$totalRows_Gender = mysql_num_rows($Gender);
?>
<!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"><!-- InstanceBegin template="/Templates/DBtemp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Business Directory</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
background-color: #CCD8E6;
}
-->
</style>
<link href="CSSfiles/CSSfiles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.ToShowOnSite {color: #FF0000}
-->
</style>
<!-- InstanceEndEditable -->
</head>
<body>
<table width="843" height="178" align="center">
<tr>
<td height="35" colspan="3" align="left" valign="top" class="Header"><!-- InstanceBeginEditable name="Head" -->
<div align="center">Page For updating Databases </div>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td width="20%" height="135" align="left" valign="top"><table width="29%" height="129">
<tr>
<td height="116" align="left" valign="top" nowrap="nowrap"><p><a href="Home.php">Home</a></p>
<p><a href="search.php">Search DB</a> <br />
<a href="Images.php">Add Images</a><br />
<a href="Feedback.php">Add Feedback</a><br />
<a href="BusinessDirectory.php">Add Business </a></p>
<p align="left">Add to<br />
Database:<br />
</p> <p>Display Listings <br />
Add County<br />
Add Town <br />
Add
<br />
</p> </td>
</tr>
</table> </td>
<td width="64%" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
<p> </p>
<form action="<?php echo $editFormAction; ?>" id="DI_Update" name="DI_Update" method="POST">
<table width="494" height="1592" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td nowrap="nowrap">DATE Entered </td>
<td> </td>
<td colspan="2"><input name="Date_entered_hid" type="hidden" value="<?php $mysqltime = date ("Y-m-d H:i:s");
echo $mysqltime;
?>" id="Date_entered_hid" />
<?php $mysqltime = date ("Y-m-d H:i:s");
echo $mysqltime;
?></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"><strong>Name and Postal Address: </strong></td>
</tr>
<tr>
<td width="102" nowrap="nowrap"> </td>
<td width="4"> </td>
<td colspan="2"> </td>
<td width="60"> </td>
<td width="14"> </td>
<td width="62"> </td>
</tr>
<tr>
<td nowrap="nowrap"><span class="ToShowOnSite">*</span>First Name</td>
<td> </td>
<td colspan="2"><input name="FirstName" type="text" id="FirstName" size="30" maxlength="30" /></td>
<td colspan="3">Gender
<select name="Gender" id="Gender">
<?php
do {
?>
<option value="<?php echo $row_Gender['Gender']?>"><?php echo $row_Gender['Gender']?></option>
<?php
} while ($row_Gender = mysql_fetch_assoc($Gender));
$rows = mysql_num_rows($Gender);
if($rows > 0) {
mysql_data_seek($Gender, 0);
$row_Gender = mysql_fetch_assoc($Gender);
}
?>
</select> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td width="156"> </td>
<td width="96"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"><span class="ToShowOnSite">*</span>Sir Name</td>
<td> </td>
<td colspan="2"><input name="SirName" type="text" id="SirName" size="30" maxlength="30" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Address 1</td>
<td> </td>
<td colspan="3"><input name="Address1" type="text" id="Address1" size="50" maxlength="50" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Address 2</td>
<td> </td>
<td colspan="3"><input name="Address2" type="text" id="Address2" size="50" maxlength="50" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Town</td>
<td> </td>
<td colspan="3"><input name="Town" type="text" id="Town" size="50" maxlength="50" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">County</td>
<td> </td>
<td colspan="2"><select name="CountyBox" id="CountyBox">
<option value="Please Select">Please Select</option>
<?php
do {
?>
<option value="<?php echo $row_County['County']?>"><?php echo $row_County['County']?></option>
<?php
} while ($row_County = mysql_fetch_assoc($County));
$rows = mysql_num_rows($County);
if($rows > 0) {
mysql_data_seek($County, 0);
$row_County = mysql_fetch_assoc($County);
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">ZipCode</td>
<td> </td>
<td><input name="ZipCode" type="text" id="ZipCode" size="10" maxlength="10" />
not needed </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap">........................................................................................................................</td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"><strong>Contact Details: </strong></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Mobile Number</td>
<td> </td>
<td><input name="MobileNumber" type="text" id="MobileNumber" size="13" maxlength="13" /></td>
<td><select name="Mobile_Type" id="Mobile_Type">
<?php
do {
?>
<option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
$rows = mysql_num_rows($Contact_Type);
if($rows > 0) {
mysql_data_seek($Contact_Type, 0);
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
}
?>
</select> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Land Line </td>
<td> </td>
<td><input name="LandLine" type="text" id="LandLine" size="15" maxlength="15" /></td>
<td><select name="LandLine_Type" id="LandLine_Type">
<?php
do {
?>
<option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
$rows = mysql_num_rows($Contact_Type);
if($rows > 0) {
mysql_data_seek($Contact_Type, 0);
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">Fax</td>
<td> </td>
<td><input name="FaxNumber" type="text" id="FaxNumber" size="15" maxlength="15" /></td>
<td><select name="Fax_Type" id="Fax_Type">
<?php
do {
?>
<option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
$rows = mysql_num_rows($Contact_Type);
if($rows > 0) {
mysql_data_seek($Contact_Type, 0);
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"><span class="ToShowOnSite">*</span>E-Mail</td>
<td> </td>
<td colspan="3"><input name="email1" type="text" id="email1" size="50" maxlength="50" /></td>
<td> </td>
<td><select name="Email_Type" id="Email_Type">
<?php
do {
?>
<option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
$rows = mysql_num_rows($Contact_Type);
if($rows > 0) {
mysql_data_seek($Contact_Type, 0);
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
}
?>
</select></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">E-Mail 2</td>
<td> </td>
<td colspan="3"><input name="email2" type="text" id="email2" size="50" maxlength="50" /></td>
<td> </td>
<td><select name="Email2_Type" id="Email2_Type">
<?php
do {
?>
<option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
$rows = mysql_num_rows($Contact_Type);
if($rows > 0) {
mysql_data_seek($Contact_Type, 0);
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
}
?>
</select></td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap">........................................................................................................................</td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"><strong>Instructor Details: </strong></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="24" nowrap="nowrap"><span class="ToShowOnSite">*</span>Instructo Pic </td>
<td> </td>
<td colspan="2"><input name="Instructor_pic" type="file" id="Instructor_pic" /></td>
<td valign="top"><br /></td>
<td colspan="2" rowspan="3" valign="top"><span class="ToShowOnSite">*</span>Categories
<select name="Category_Type" size="6" id="Category_Type">
<?php
do {
?>
<option value="<?php echo $row_Category_Type['Category_Type']?>"><?php echo $row_Category_Type['Category_Type']?></option>
<?php
} while ($row_Category_Type = mysql_fetch_assoc($Category_Type));
$rows = mysql_num_rows($Category_Type);
if($rows > 0) {
mysql_data_seek($Category_Type, 0);
$row_Category_Type = mysql_fetch_assoc($Category_Type);
}
?>
</select></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td valign="top"> </td>
</tr>
<tr>
<td><p><span class="ToShowOnSite">*</span>Instructor Quaifications<br />
/ Membership
</p> </td>
<td> </td>
<td><select name="InstructorQual[]" size="4" multiple="multiple" id="InstructorQual">
<?php
do {
?>
<option value="<?php echo $row_Instructor_Qual['Instructor_Qualifacations']?>"><?php echo $row_Instructor_Qual['Instructor_Qualifacations']?></option>
<?php
} while ($row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual));
$rows = mysql_num_rows($Instructor_Qual);
if($rows > 0) { // if ($val!=''){
mysql_data_seek($Instructor_Qual, 0);
$row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual);
}
?>
</select></td>
<td valign="top"><p><span class="ToShowOnSite">*</span>ADI Number <br />
<input name="ADI_Number" type="text" id="ADI_Number" size="7" maxlength="7" />
<br />
</p> </td>
<td valign="top"> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap">........................................................................................................................</td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"><strong>Business Information:</strong></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><p><span class="ToShowOnSite">*</span>Business Name<br />
Place of work </p> </td>
<td> </td>
<td colspan="3" align="right" valign="middle"><input name="Business_Name" type="text" id="Business_Name" size="50" maxlength="50" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"><div align="right"><span class="ToShowOnSite">*</span>Business Phone</div></td>
<td> </td>
<td nowrap="nowrap">1
<input name="Business_No1" type="text" id="Business_No1" /></td>
<td colspan="2" nowrap="nowrap">2
<input name="Business_No2" type="text" id="Business_No2" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">*Website</td>
<td> </td>
<td colspan="3"><input name="Website" type="text" id="Website" size="50" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Business Type</td>
<td> </td>
<td><select name="BusinessType" size="4" multiple="MULTIPLE" id="BusinessType">
<?php
do {
?>
<option value="<?php echo $row_Business_type['Business_type']?>"><?php echo $row_Business_type['Business_type']?></option>
<?php
} while ($row_Business_type = mysql_fetch_assoc($Business_type));
$rows = mysql_num_rows($Business_type);
if($rows > 0) {
mysql_data_seek($Business_type, 0);
$row_Business_type = mysql_fetch_assoc($Business_type);
}
?>
</select></td>
<td colspan="2" align="left" valign="top">Hold the ctrl key to select more than one business type. </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Logo</td>
<td> </td>
<td colspan="2"><input name="Logo" type="file" id="Logo" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="center" valign="top" nowrap="nowrap"><span class="ToShowOnSite">*</span>Company Info</td>
<td> </td>
<td colspan="3"><textarea name="Comapny_info" cols="40" rows="10" wrap="virtual" id="Comapny_info"></textarea></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Area Coverd </td>
<td> </td>
<td colspan="2"><select name="AeraCovered" size="5" multiple="multiple" id="AeraCovered">
<?php
do {
?>
<option value="<?php echo $row_Covered['Covered']?>"><?php echo $row_Covered['Covered']?></option>
<?php
} while ($row_Covered = mysql_fetch_assoc($Covered));
$rows = mysql_num_rows($Covered);
if($rows > 0) {
mysql_data_seek($Covered, 0);
$row_Covered = mysql_fetch_assoc($Covered);
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap">........................................................................................................................</td>
</tr>
<tr>
<td colspan="7" nowrap="nowrap"><span class="ToShowOnSite"><strong>Category of Business Listing </strong></span></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"><span class="ToShowOnSite">Listing Type</span> </td>
<td> </td>
<td><select name="Listing Type" id="Listing Type">
<option value="Please Select">Please Select</option>
<?php
do {
?>
<option value="<?php echo $row_Listing_Type['Listing_type']?>"><?php echo $row_Listing_Type['Listing_type']?></option>
<?php
} while ($row_Listing_Type = mysql_fetch_assoc($Listing_Type));
$rows = mysql_num_rows($Listing_Type);
if($rows > 0) {
mysql_data_seek($Listing_Type, 0);
$row_Listing_Type = mysql_fetch_assoc($Listing_Type);
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td valign="top">Notes about this coustomer </td>
<td> </td>
<td colspan="2"><textarea name="Persional_Notes" wrap="physical" id="Persional_Notes"></textarea></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /></td>
<td><a href="phpScripts/Submit.php">Submit Link </a></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="19" nowrap="nowrap"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="DI_Update">
</form>
<p> </p>
<p> </p>
<!-- InstanceEndEditable --></td>
<td width="16%" align="left" valign="top"><table width="17%" height="66" align="right">
<tr>
<td height="40" align="left" nowrap="nowrap">My Websites:<br />
</td>
</tr>
</table> </td></tr>
</table>
</body><!-- InstanceEnd -->
</html>
<?php
mysql_free_result($Master_info);
mysql_free_result($Business_type);
mysql_free_result($County);
mysql_free_result($Covered);
mysql_free_result($Instructor_Qual);
mysql_free_result($Listing_Type);
mysql_free_result($Contact_Type);
mysql_free_result($Category_Type);
mysql_free_result($Gender);
?>
Re: one value in one field
I'm not sure I understand what you are asking. If you are referring to storing more than one value in a field of a table, that is a violation of First Normal Form and is going to get you into all sorts of difficulty with your database, down the road. Quoting from http://dev.mysql.com/tech-resources/art ... on.html#03, "The first normal form (or 1NF) requires that the values in each column of a table are atomic. By atomic we mean that there are no sets of values within a column."
If that's not what you meant, perhaps you can explain what you do mean.
If that's not what you meant, perhaps you can explain what you do mean.
Re: one value in one field
What i need is:
Say the user select values below and then submits, How do i get all selected values to input into one field
value1 value3 value5 value9 value10
Say the user select values below and then submits, How do i get all selected values to input into one field
value1 value3 value5 value9 value10
Code: Select all
<form id="form1" name="form1" method="post" action="">
<p>
<select name="select" size="10" multiple="multiple">
<option>value1</option>
<option>value2</option>
<option>value3</option>
<option>value4</option>
<option>value5</option>
<option>value6</option>
<option>value7</option>
<option>value8</option>
<option>value9</option>
<option>value10</option>
</select>
</p>
<p>Press Ctrl key for more than one selection </p>
</form>Re: one value in one field
You don't. As I said earlier, that doesn't work in databases. One field, one value. I can't design a database for someone remotely, but you probably need ten fields, if you're going to allow any or all to be chosen. There are other much more complex ways to store data, such as bit-mapping, but I don't want to go there. Again, if you would explain what you are dealing with, maybe we can give you more help, but the fundamental rule of relational databases is that every column (field) should be "atomic", meaning that it must contain one and only one value for each row.tod900 wrote:What i need is:
Say the user select values below and then submits, How do i get all selected values to input into one field
value1 value3 value5 value9 value10
Re: one value in one field
what i need is values selected from a list box sent to database field.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: one value in one field
Sounds like your database has not been normalised. From what you've described it sounds like the best solution would be to store eash selected value as a seperate row in a table. Using this method you only need to create one field and you can reference other table fields using keys/ids/unique fields.
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: one value in one field
How about after post do something like this:
Or do you mean that you want to insert array into database, now that would be whole new thing.
Code: Select all
foreach($_REQUEST['select'] as $val)//I HAD PROBLEMS WITH $_POST!!
{
INSERT INTO DATABASE .....
}
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: one value in one field
Storing the array would require less work I guess. Simply serialize() it.
Re: one value in one field
Use checkboxes or multiple selecttod900 wrote:What i need is:
Say the user select values below and then submits, How do i get all selected values to input into one field
value1 value3 value5 value9 value10
Code: Select all
<form id="form1" name="form1" method="post" action=""> <p> <select name="select" size="10" multiple="multiple"> <option>value1</option> <option>value2</option> <option>value3</option> <option>value4</option> <option>value5</option> <option>value6</option> <option>value7</option> <option>value8</option> <option>value9</option> <option>value10</option> </select> </p> <p>Press Ctrl key for more than one selection </p> </form>