Hi,
Total php novice here and not even sure if I'm in the right forum at all but looking for help nonetheless!
I have inherited a project of monitoring newspapers and I'm having trouble pulling the correct information into the database.
This code sends info to the database and it works (I've left some parts out which I'm assuming the experts here will know!):
if ($_POST['submit']) {
$date = date('Y/m/d');
openDatabase();
//insert form values is to database table
$insert = "INSERT INTO newspaper_data VALUES ('','".$_POST['area']."',
'".$_POST['date']."',
'".$_POST['headline']."',
'".$_POST['summary']."',
'".$_POST['outlet']."',
'".$_POST['readership']."',
'".$_POST['impact']."',
'".$_POST['coverage']."');";
//echo $insert;
$result = mysql_query($insert) or die (mysql_error());
closeDatabase();
My problem is with 'outlet'.
Within my html I have numerous drop-downs set up using a Form Dependency Manager that I downloaded from Dynamic Drive (that's what the class element refers to). There are 8 in total all are named 'outlet' e.g.
<select name="outlet" class="DEPENDS ON area BEING Central">
<option value="Alcester Chronicle">Alcester Chronicle</option>
<option value="Alfreton Chad">Alfreton Chad</option>
</select>
<select name="outlet" class="DEPENDS ON area BEING East">
<option value="Advertiser (Great Yarmouth)">Advertiser (Great Yarmouth)</option>
<option value="Barking & Dagenham Post">Barking & Dagenham Post</option>
</select>
<select name="outlet" class="DEPENDS ON area BEING Wales">
<option value="Abergavenny Chronicle">Abergavenny Chronicle</option>
<option value="Abergavenny Free Press">Abergavenny Free Press</option>
</select>
When I check the results that get posted to the database only options from the last drop-down (in this case Wales) are recorded. If I choose something from Central or East then it is ignored and the top option of Wales is recorded (Abergavenny Chronicle). If I choose something from Wales then that choice is posted correctly.
A solution to this would simply be to give each drop down a different name and amend the php code and database accordingly, but it would make my life much easier if the options from the various drop-downs could all be recorded within 'outlet'.
Any ideas would be most welcome (even if it's referring me to the right forum!).
Many thanks,
Thomas