I have a pretty simple form at:
http://www.flinginarrows.com/Ranges/AddRanges/addranges.php
Part of the insert statement:
$select = $_POST['services'];
$services=implode(',',$services);
$sql = "INSERT INTO ranges (rangename,website,claddress,claddressb,clcity,clstate,clzip,clphone,clfax,coname,coaddress,coaddressb,cocity,costate,cozip,cophone,coemail,cofax,services,userfile_name)
VALUES ('$rangename','$website','$claddress','$claddressb','$clcity','$clstate','$clzip','$clphone','$clfax','$coname','$coaddress','$coaddressb','$cocity','$costate','$cozip','$cophone','$coemail','$cofax','$services','$userfile_name')";
$result = mysql_query($sql);
}
echo "Thank you! Information entered.<br>\n";
} else{
// display form
Currently as you can see I have everything going into their own field except for the services, which began as an array.
Would it make more sense to combine the range information and the contact information into their own array or does it make more sense to keep them as independent fields?
The reason I ask is that any one of the fields can be left blank and the way I am displaying them now:
<?PHP printf("%s<br>\n", $myrow["claddress"]);?>
<?PHP printf("%s<br>\n", $myrow["claddressb"]);?>
<?PHP printf("%s %s<br>\n", $myrow["clcity"], $myrow"[clstate"]);?>
<?PHP printf("%s<br>\n", $myrow["clzip"]);?>
<?PHP printf("%s<br>\n", $myrow["clphone"]);?>
<?PHP printf("%s<br>\n", $myrow["clfax"]);?>
You can see that I will print a <br> regardless if there is anything there or not.
Would it be easier to just do an "if its not empty check" before each print or is my design way out in center field somewhere?