PDA

View Full Version : Forms


bartainer
06-07-2005, 03:15 PM
Hello;

I'm building a form in DW that is PHP controlled (mail).

However, I am having trouble with this delema! How can I make it easier for my client to indentify a question to an answer? E.g., here is a sample question: How old are you? (age values here).

Once my client receives the form answers via email, there are only answers but no question to match with the anwers. I already know it can be done with check boxes and radio buttons. However, can it be done with text fileds?

Ron

domedia
06-07-2005, 03:28 PM
Absolutely, how does your form action look now?

bartainer
06-07-2005, 03:35 PM
http://www.wnybesthomes.com/sellers.php ('http://www.wnybesthomes.com/sellers.php')

As you see the question: Do you own acreage? I have a drop down with "yes" or "no". However, how do I know the question to the answer when it arrives in my mail box? Only "yes" or "no" will be there! I mean it does not take a genius to know the the question is: Do you own acreage? But, I'd like my client to see the simplicity!

Thanks.

Ron

domedia
06-07-2005, 03:39 PM
I need to see the script that generates the email, not the form itself.

bartainer
06-07-2005, 03:42 PM
Below is the PHP script minus the email address!


<?
include ("common/libmailer.php");
$m = new Mail ();

if (($_POST['name'] == "") || ($_POST['email'] == ""))
{
session_start ();
$return_array = array ( "name" => $_POST['name'], "email" => $_POST['email'] );

//print_r ($return_array);

session_register ("return");
$_SESSION['return'] = $return_array;
header ("Location: " . $_POST['source_page']);
}
// Now we want to ensure that a valid email address has been entered
$regexp =
"^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
$email = $_POST["email"];

$isvalid = 'Invalid_Email_address';
if (eregi($regexp, $email)){
// Valid looking address
$isvalid = 'Yes';
}

if ($isvalid != 'Yes') {
echo "ERROR - Oops! It seems that you have entered an invalid email address - I could never
contact you at $email

Please use your back button to return to the previous page and please complete the form! Thank you!
\n";
$baddata = 'BAD';
}
else
{
$m->From($_POST['email']);
//took out email addresses
$m->Subject( $_SERVER['HTTP_HOST']);
$break_character = "
\n";
$message = "Information request from www.wnybesthomes.com" . $break_character . $break_character . $_POST['name'] . $break_character . $_POST['address'] . $break_character . $_POST['city'] . ", " . $_POST['state'] . $break_character . $_POST['zip'] . $break_character . $break_character . $_POST['phone'] . $break_character . $break_character . $_POST['phone2'] . $break_character . $break_character . $_POST['comment'];
if ($_POST['01'] != NULL)
$message .= $break_character . $break_character .$_POST['01'];
if ($_POST['area_desired'] != NULL)
$message .= $break_character . $break_character .$_POST['area_desired'];
if ($_POST['type_of_home'] != NULL)
$message .= $break_character . $break_character .$_POST['type_of_home'];
if ($_POST['qualify'] != NULL)
$message .= $break_character . $break_character .$_POST['qualify'];
if ($_POST['acreage'] != NULL)
$message .= $break_character . $break_character .$_POST['acreage'];
if ($_POST['02'] != NULL)
$message .= $break_character . $break_character .$_POST['02'];
if ($_POST['03'] != NULL)
$message .= $break_character . $break_character .$_POST['03'];
if ($_POST['04'] != NULL)
$message .= $break_character . $break_character .$_POST['04'];
if ($_POST['05'] != NULL)
$message .= $break_character . $break_character .$_POST['05'];
if ($_POST['06'] != NULL)
$message .= $break_character . $break_character .$_POST['06'];
if ($_POST['07'] != NULL)
$message .= $break_character . $break_character .$_POST['07'];
if ($_POST['08'] != NULL)
$message .= $break_character . $break_character .$_POST['08'];
if ($_POST['09'] != NULL)
$message .= $break_character . $break_character .$_POST['09'];
if ($_POST['subject'] != NULL)
$message .= $break_character . $break_character .$_POST['subject'];

$m->Body( $message); // set the body
$m->Send(); // send the mail

header ("Location: " . $_POST['process_to']);
}

?>

kate
06-09-2005, 07:57 PM
Bartainer hi,

Visit friends of ed, they just gave the solution to an ongoing problem posted at mine. ok it was complicated but after many searches at Macromedia and other sites we worked with my member and got him some where close to where he wanted to be. friends of ed was the one who helped the most and gave the solution.

one problem may or may not be register_globals which Dreamweaver turns off as its a security thing no patch is currently available but you could ask host to turn it on.

Good luck!

http://friendsofed.infopop.net/2/OpenTopic ('http://friendsofed.infopop.net/2/OpenTopic')

:D