Hi,
I have a form that a user can submit, and it displays the results of their submission in a table on a new page. It also exports the data to a .csv file. All of the data being exported was originally part of a MySQL data base, but recently, I added in a new text field for Attention Line that a user just enters in on the form. Now my method of exporting the data as a CSV doesn’t pull the new text field (because it’s not stored in the database). Can anyone help with this? I’m new to programming, and am not sure the best way to revise my code. Here is what I have:
html form:
Mailing List Report
Please select the regions to be included:
New Hampshire
Vermont
Maine
Western Massachusetts
Rhode Island
Southern Maine
Northern Connecticut
Western Connecticut
Eastern New York Albany
Eastern New York Plattsburg
Central New York
Other:
<label for “attnline”>Attention Line:
PHP Document:
<?php $astates = $_POST['state']; $attnline = $_POST['attnline']; print_r($astates); $link = mysqli_connect('localhost', 'uname', 'password', 'mailings'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; $result = mysqli_query($link,"SELECT * FROM mailing_lists WHERE label IN ('".implode("','",$astates)."')"); echo "Attention Line | First Name | Last Name | Hospital Name | Address Line 1 | Address Line 2 | City | State | Zip | Country |
---|---|---|---|---|---|---|---|---|---|
" . $attnline . " | "; echo "" . $row['first'] . " | "; echo "" . $row['last'] . " | "; echo "" . $row['hospital'] . " | "; echo "" . $row['addline1'] . " | "; echo "" . $row['addline2'] . " | "; echo "" . $row['city'] . " | "; echo "" . $row['state'] . " | "; echo "" . $row['zip'] . " | "; echo "" . $row['country'] . " | "; echo "