Forum Moderators: mack
Ideally I would like to have the information sent to the appropriate database/server log as well as get an email notification when a form is completed.
any help is appreciated.
-Herb
For example you could send users from your sales page to the form using a url like this...
example.com/feedback/form.php?area=sales
The form could then decide what fields to display to users based on what variable you passed to the script. You could then write the results to a database incuding the area they where refered from. e.g. sales.
Hope this helps.
Mack.
code like the following should work...
<form method="get" action="http://www.example.com/feed-back.php">
<?php
if ($area == 'sales'){
place form here for sales feedback form.
}else
if ($area == 'about'){
place form here for about feedback form.
}else{
place form here for general feedback form.
</form>
?>
the above code will present the correct form depending on what area they are send to. If this code was on www.example.com/form.php we would send it to www.example.com/form.php?area=sales to display the sales feedback form.
The form then needs to send it's data to another script to write the information to mysql.
<?php
$link = mysql_connect(localhost, DBuser, DB password);
$db = mysql_select_db(DBname, $link);$query = "INSERT INTO Your Table (value1, value2, value3, value4, value5, value6) VALUES ('$calue1', '$value2', '$value3', '$value4', '$value5', '$value6')";
$result = mysql_query($query, $link);echo "Thank you very much for contacting us.";
?>
The values would be specified within your form fields.
Hope this gives you some ideas.
Mack.
[edited code.]
[edited by: mack at 11:43 pm (utc) on Aug. 15, 2005]
<?php
if ($var = 'val') {-do something-;}
?>
I know because it's a mistake I make all the time. The above code would set the value of $var to 'val'. You need *two* equal signs to do the 'is equal' operation, a single equal sign just assigns the value. So... what you'd want to be sure you do is:
<?php if ($var == 'val') {-do something-;}?>
with two equal signs and no spaces :)