I have a script that collects information from a contact form. Some of the fields in the contact form are dynamically generated from the database. When I do an insert into the customer table i insert the ID of this field, depending on what the customer selected from the drop down list. The script puts all the form variables into an array called cotactFormVars. I am trying to query the database for the id number of the option the customer chooses and then insert the id number into the customer table. When I do this the database either says Array in the field where the id number should be or is blank.
Here is the select statement I am using to query the database with.
if (!($serviceid = @ mysql_query ("SELECT service_id from services " .
"where service = \"" . $contactFormVars["services"] . "\"", $connection)))
showerror();
$serid = @ mysql_fetch_array($serviceid);
I also wrote the select statement like this.
if (!($countryid = @ mysql_query ("SELECT country_id from country
WHERE country = '$country'", $connection)))
showerror();
$cid = @ mysql_fetch_array($countryid);
Here is how I wrote the database insert where it says array in the field where the id number should be.
"country_id = \"" . $cid . "\", " .
Here is how I wrote the database insert where it says nothing in the field where the id number should be.
"country_id = \"" . $cid["countryid"] . "\", " .