Page 1 of 2

HELP!!! making on-line form

Posted: Sat Nov 24, 2007 6:57 pm
by Leonardo
Okay, it seems that I always need help with a different on-line form... so you guys probably know the drill by now :lol:

This is what I need to show in the web site

Name of person: (fill in the blank)

Drop down menu with either:
- I would like to attend
- I won't be able to attend

Drop down menu with either:
- I'm friend of leo
- I'm friend of Meghan
- I'm a friend of leo and meghan

Number of people attending: (fill in the blank or drop down menu w numbers)

Check box:
[] I need the adress of the event

Message:
(big blank box)

[Send] [clear]

======
I would like to have this sent to two differnt e-mails (if that is two hard, then I will settle with just one)

I would like for the e-mail tittle to be: (event "X") and have all the information neatly inside the email :D

Also I would like to have two diffrent messge displayed once the form is sent:
One that says: We are glad you can join us in our even
and one that says: We are sorry to hear that you won't be able to make it to our event


Sounds simple enough!! ANybody wants to spoon feed me :lol:

Thanks a lot!!!!
leo

Posted: Sat Nov 24, 2007 7:00 pm
by Leonardo
php? :D (is that how it's call :lol: )

Posted: Mon Nov 26, 2007 11:43 am
by mmhnemo
Hi Leo,

instead of going into details have a look at http://www.hotscripts.com/
There you can find form generators/validators etc. for every flavor of internet technology.

PHP is server side so if you are sure you can run these there are many pieces of code for that on the site i mentioned above.

regards

Posted: Mon Nov 26, 2007 5:47 pm
by Leonardo
Now that I'm back in Miami and have my pc.... I'm going to give it a try myself!!

I'll report with questions soon :wink:

Posted: Mon Nov 26, 2007 9:23 pm
by Fernando Tella
Getting married or just a special party? :D

Anyway, have fun.

No idea about online forms, sorry.

Posted: Mon Nov 26, 2007 10:10 pm
by -Adrian
Leonardo wrote:L'll report with questions soon :wink:
Yes feel free, i just got out of the self torture of updating benchwell, so my memory is fresh.
Getting married or just a special party? :D
Miami Swingers :wink:

Posted: Mon Nov 26, 2007 11:06 pm
by Leonardo
Fernando Tella wrote:Getting married or just a special party? :D

Anyway, have fun.

No idea about online forms, sorry.
We ran out of wedding invitations :oops: so an on-line form will do! :lol:

I don't have much time... it's on dec 29 :shock:

Posted: Tue Nov 27, 2007 1:17 am
by Leonardo
Okay I have this from last time...
Hey your no pain… glad I can help :)
ok give this a try we can refine it a little better if needed…I’m on my way out the door so I didn’t have time to make it nicer…but when I come back I’ll see were your at.


Cheers,
Mark
Code: Select all
<form method="POST" action="contactconfirm.php"> 
        <p align="center">&nbsp;</p> 
        <p align="center"><b><font size="2" face="Verdana">Name: <input type="text" name="name" size="33" style="border: 1 solid #000000"></font></b></p> 
		<p align="center"><b><font size="2" face="Verdana">Phone Number: <input type="text" name="phone" size="33" style="border: 1 solid #000000"></font></b></p> 
		<p align="center"><b><font size="2" face="Verdana">Email Address: <input type="text" name="from" size="31" style="border: 1 solid #000000"></font></b></p> 
                <p align="center"><b><font size="2" face="Verdana">Message:</font></b></p> 

<center> 
<p align="center"><textarea rows="11" name="note" cols="46"></textarea></p> 
<p align="center"><input type="submit" value="Submit" name="B1"> 
<input type="reset" value="Clear" name="B2"></p> 
        </form> 
Code: Select all
<?php 
/* this pages recives and handles the data from contact.php 
*/ 
$name = $name;
$phone = $phone;
$note = $note; 
$from = $from; 
$to = "YOUR_EMAIL@ADDRESS.COM"; 
$subject = "Tere Contact Form"; 
$message = "$name<br>$phone<br>$from<br><br>$note"; 
$headers = "MIME-Version: 1.0\n";    

                        $headers .= "Content-Type: text/html; charset=iso-8859-1\n";    

                        $headers .= "X-MSMail-Priority: Normal\n";    

                        $headers .= "From: <$from>\n";    

                        $headers .= "Reply-To: <$from>\n"; 

// Filter out email injection 
if ((preg_match('/\\\[rn]/i', $from)) || (preg_match('/\\\[rn]/i', $subject))) { 
   die("<center><b><font size=3 color=#000000>Spammers not welcome! If you believe you received this error incorrectly then please email us at $to </center></font></b>"); 
}else{ 
mail( $to, $subject, $message, $headers) and print "<b><font size=3 color=#000000> Thank you your email has been received. You should receive a reply soon from one of our representatives.</font></b>" or print "<b><font size=5> Could not send try again</font></b>"; 
} 
?>
now, I need to figure out to do a "Drop down menu" and a check box!

Posted: Tue Nov 27, 2007 1:51 am
by MarkM
Hey Leo,
Congrats!

heres the form code
Code: Select all
<html>
<head>
<title>Web Form</title>
</head>

<body>

<form method="POST" action="form1_confirm.php">
  <p>Name: <input type="text" name="sender_name" size="20"></p>
  <p><select size="1" name="attend">
    <option>I would like to attend</option>
    <option>I won't be able to attend</option>
  </select></p>
  <p><select size="1" name="friend">
    <option>I'm friend of leo</option>
    <option>I'm friend of Meghan</option>
    <option>I'm a friend of leo and meghan</option>
  </select></p>
  <p><input type="checkbox" name="C1" value="ON"> I need the address of the
  event</p>
  <p>Message:</p>
  <p><textarea rows="11" name="note" cols="48"></textarea></p>
  <p><input type="submit" value="Send" name="B1">&nbsp; <input type="reset" value="Clear" name="B2"></p>
</form>

</body>

</html>

name this form1_confirm.php and put in the same directory of the html form.
Code: Select all
<?php 
$note = $note; 
//$from = $from;
$to  = 'email1@domain.com' . ', ';
$to .= 'email2@domain.com';
$subject = 'event "X"'; 
$sender_name = $sender_name;
$friend = $friend;
$attend = $attend;
$C1 = $C1;
if ( $attend == 'I would like to attend' ) {
	$attend_message = 'We are glad you can join us in our event';
}else{
$attend_message = 'We are sorry to hear that you won\'t be able to make it to our event';
}

if ( $C1 == 'ON' ) {
	// address is needed
	$address = 'Address is needed';
	
}else{
	// address not needed
	$address = ' address not needed';
	
	}


$message = 'Name:' . $sender_name . '<br>' . $friend . '<br>' . $attend . '<br>' . $address . '<br>Message: ' . $note; 
//$headers = "MIME-Version: 1.0\n";   

                        $headers .= "Content-Type: text/html; charset=iso-8859-1\n";   

                        $headers .= "X-MSMail-Priority: Normal\n";   

                        $headers .= "From: <$from>\n";   

                        $headers .= "Reply-To: <$from>\n"; 



if ((preg_match('/\\\[rn]/i', $from)) || (preg_match('/\\\[rn]/i', $subject))) {
  // die("<center><b><font size=3 color=#000000>Spammers not welcome! If you believe you received this error incorrectly then please email us at $to </center></font></b>"); 
}else{
mail( $to, $subject, $message, $headers) and print "<b><font size=3 color=#000000>$attend_message</font></b>" or print "<b><font size=5> Could not send try again</font></b>"; 
}

?>

Let me know how this works for you. :D

Cheers,
Mark

Posted: Tue Nov 27, 2007 4:04 pm
by Leonardo
that looks pretty good! Now, I can't wait to get out of work !! :lol:

Posted: Fri Nov 30, 2007 5:36 pm
by -Adrian
So how was the wedding night!?

Posted: Fri Nov 30, 2007 6:14 pm
by Leonardo
the form came out good... The wedding night is in dec 29.... :D


I can't post the form here, as I would be affraid to get a billion request for invitations all around the world :lol: when our limit is 100 people and it's already filled :lol:

Posted: Fri Nov 30, 2007 6:19 pm
by Fernando Tella
Leonardo wrote:the form came out good... The wedding night is in dec 29.... :D


I can't post the form here, as I would be affraid to get a billion request for invitations all around the world :lol: when our limit is 100 people and it's already filled :lol:
:lol:

I confirm I won't go. :P

Congrats Leo! And remember: have fun and don't get too stressed.

Posted: Fri Nov 30, 2007 6:44 pm
by Leonardo
Fernando Tella wrote: And remember: have fun and don't get too stressed.
Don't worry, I got just thing to keep the stressed off my back.....


Image

Posted: Fri Nov 30, 2007 7:07 pm
by Fernando Tella
Wooo! That looks good. :D

Be careful, Roatán seems to be in the middle of the sea. Maybe it's one of those villages built with timber piles over the sea?

Edit: ok, that's an island, and looks gooood:

Image

Image

Oops, sorry for the big off topic. :oops: