I am now working on the insert into two tables
items and items_city
In each table there is the ID which is unique. This is what I have so far and I am not getting very far with it.
select from city and display ready for check box selection.
Code: Select all
echo "Select Cities and Towns<br>";
echo "</td></tr>";
$queryC="SELECT CountyID, City, CityID FROM city WHERE CountyID=".$CountyID." ORDER BY City";
$result=mysql_query($queryC,$con_id);
$count=0;
echo "<tr>";
while($row=mysql_fetch_array($result)){
$county_id=$rowї'CountyID'];
$city_id=$rowї'CityID'];
$city=$rowї'City'];
if ($CityID == $city_id)
$city="city_".$cityId;
echo"<td width="25%"><input type="checkbox" name="$city_id">$city</td>";
$count++;
if($count ==3){
echo "</tr><tr>";
$count=0;
}
}
once selected this is the form that should do the inserts ->
Code: Select all
<?
require("connection.php");
DBInfo();
Root();
$con_id=mysql_connect("$DBHost","$DBUser","$DBPass");
mysql_select_db($DBName);
mysql("$DBName","INSERT INTO Items VALUES(
'$ItemSKU',
'$ItemName',
'$ItemDescription',
'$PostCode',
'$Category',
'$CityID',
'$CTelephone',
'$ItemID',
'$Cfax',
'$Cemail',
'$Caddress',
'$CTown',
'$Cwww')");
$nItemId=mysql_insert_id();
$queryC="select * from city";
$result=mysql_query($queryC,$con_id);
while($row=mysql_fetch_array($result)){
$cityId=$rowї'CityID'];
$city="city_".$cityId;
$c=$$city;
if($c == "on"){
$query1="insert into item_city (item_id,city_id)values('$nItemId','$cityId')";
$result1=mysql_query($query1);
}
}
/////////////////////////
?>
I have looked at this for too long and seem to be seeing the same thing

so if someone can see something aloof that would be great
Andrew