Copy link to clipboard
Copied
I'm new to DW CS4, the learning curve has been steep but I'm getting the hang of it now. I have created an airshow website here (www.hollisterairshow.com ) which works just fine. I've been asked to add some basic questions to the web site (are you coming by car/ airplane,which day, camping overnight etc). I have a draft of the questions at the lower right corner here www.hollisterairshow.com/index2.html , they are very simple and all I need is to a total showing the sum of the answers, no login, no reservations etc. Ideally I'd like to have a submit button that changes to a "Thank you" message when a user has submitted their response and remains as a "Thank you" if they visit the site again. Do I need to set up a data source or something for this, I'm having a hard time figuring out how to start. So, what's the simplest way of implementing something like this?
Thanks
Tony
Hi
You would still require php to be enabled on the server to do this but you could simply append the data to an CSV file, (comma seperate file) then copy the file to your computer to view the data.
The code would be similar to, (no error checking, or anti spam included in this example) -
<?php
if ($_POST)
{
$fh = fopen("feedback.csv", "w+");
$name = $_POST['name'];
$email = $_POST['email_id'];
$feedback = $_POST['feedback'];
$success = fwrite($fh, "Name: {$name}, Em
Copy link to clipboard
Copied
Hi
First to get this to work you will have to have a server side language enabled on your hosting server, (preferably php, as this is more widely supported, should you have problems).
Then the procedure would be the same as sending a contact or feedback forms data to yourself via email.
Ideally I'd like to have a submit button that changes to a "Thank you" message when a user has submitted their response and remains as a "Thank you" if they visit the site again.
Both these items would require the use of javascript or a javascript framework such as jQuery, the first on would be a simple processing of the response from your email sending, (processing) script, to set the button name to 'Thank You' and disable it to prevent resubmission. The second part would require you to 'set a javascript cookie' that would be read every time your user visited the page and setting the button as per the javascript processing of the response from the email seding script.
PZ
Copy link to clipboard
Copied
I've been reading up on JavaScript and think I understand how to do the coding for setting/ testing for a cookie which will tell me whether the user has already responded and allow me to display the questions or the totals, thanks. I'd prefer to not have potentially hundreds of e-mails that have to be read and answers counted. Can the totals just be stored on the website and incremented when the user presses "Submit"? The totals I would need are:
Saturday - #Autos, #Aircraft, #Other, #occupants
Sunday - #Autos, #Aircraft, #Other, #occupants
#campers
This is not a financial application and the results will not guarantee attendance, we're just looking for an idea of how many might come each day as this is the first time we've run this event, so this doesn't have to be a bulletprooof application. What is the simplest way to implement this?
Regarding enabling PHP is this just a yes/no option in the control panel or there other options for it? I don't have direct access to this because the City of Hollister owns the website, I'm just volunteering to create it so I need to know what to ask the city's web administrator for.
Thanks so much for your assistance,
Tony Babb
Copy link to clipboard
Copied
>Can the totals just be stored on the website
>and incremented when the user presses "Submit"?
Yes, you would store that data in a database. If the site supports php and MySQL, it would be a fairly simple matter using DW's built in insert server behavior.
Copy link to clipboard
Copied
It may be simple when you know MySQL etc but not for me......sigh. Do I really have to impement a database management system just to store and increment 9 counters? It seems like overkill to me but I don't have a better idea, unless I could add a simple spreadsheet to store the counters. I thought/ hoped this would just be an extension to a simple visitor counter.
Thanks,
Tony
Copy link to clipboard
Copied
Hi
You would still require php to be enabled on the server to do this but you could simply append the data to an CSV file, (comma seperate file) then copy the file to your computer to view the data.
The code would be similar to, (no error checking, or anti spam included in this example) -
<?php
if ($_POST)
{
$fh = fopen("feedback.csv", "w+");
$name = $_POST['name'];
$email = $_POST['email_id'];
$feedback = $_POST['feedback'];
$success = fwrite($fh, "Name: {$name}, Email: {$email}, Feedback: {$feedback}\r\n");
fclose($fh);
if ($success) {
echo "Thank you for your contact/feedback!";
} else {
echo "There was a problem processing your feedback.";
}
}
?>
Don't forget to create a file named feedback.csv, (blank file) for the php script to write to.
PZ