PDA

View Full Version : Hey Help with a little PHP!



LavaEagle
20-10-2008, 01:02 PM
I have some simple Blah:
<html>
<body>


<form name="type" action="">
First Name:

<input type="text" name="firstname">


Last Name:

<input type="text" name="lastname">




What kind computer user do you consider yourself?



Casual User


<input type="checkbox" name="cas" value="Casual User">


Developer


<input type="checkbox" name="dev" value="Developer">


Gamer


<input type="checkbox" name="gam" value="Gamer">


Business


<input type="checkbox" name="bus" value="Business">


Enthusiast


<input type="checkbox" name="ent" value="Enthusiast">


<input type="submit" value="Submit">
</form

What I need from this blah is the PHP that automatically sends an email to my email when they click submit without having to login to their email and all that crap. I was thinking if I could make the website somehow send it so when i get the email with the email it has the websites ip address or I could just make an email for it to use. Not really sure what to do here.

Teddi
20-10-2008, 03:14 PM
That isnt php, that's html.

George
20-10-2008, 03:18 PM
I can set it up for you when I get home, it is not that hard at all.

angry biker
20-10-2008, 04:39 PM
That isnt php, that's html.

George
20-10-2008, 04:49 PM
That is the HTML side, he wants the PHP side coding lol!

angry biker
20-10-2008, 04:50 PM
We know <.<

Whitefang
20-10-2008, 05:10 PM
mail();

George
20-10-2008, 05:54 PM
That is not a function to use lol.

cpf
20-10-2008, 06:02 PM
That is not a function to use lol.
Pretty sure mail() is a function... (http://ca.php.net/manual/en/function.mail.php)
let's assume the file is named mailme.php

<html>
<body>
<?php
if (@$_POST["firstname"]!=""){
$type="";
if (@$_POST["cas"]) $type.="Casual user,";
if (@$_POST["bus"]) $type.="Buisness,";
if (@$_POST["dev"]) $type.="Developer,";
if (@$_POST["gam"]) $type.="Gamer,";
if (@$_POST["ent"]) $type.="Enthusiast";

$msg="Name:". $_POST['firstname']." ".$_POST["lastname"]."
Type: ".$type;
mail("[email protected]","Survey from ".$_POST['firstname']." ".$_POST["lastname"],$msg);
echo "Sent!";
}
?>
<form name="type" method="POST" action="mailme.php">
First Name:

<input type="text" name="firstname">


Last Name:

<input type="text" name="lastname">




What kind computer user do you consider yourself?



Casual User


<input type="checkbox" name="cas" value="Casual User">


Developer


<input type="checkbox" name="dev" value="Developer">


Gamer


<input type="checkbox" name="gam" value="Gamer">


Business


<input type="checkbox" name="bus" value="Business">


Enthusiast


<input type="checkbox" name="ent" value="Enthusiast">


<input type="submit" value="Submit">
</form>

No field validation, not tested, gtg.
OK, tested, should work. Not the most efficient, but I think it's as efficient as it needs to be (and making it any more efficient would make it more complicated). And amazing that it functioned when I wrote it in ~5 minutes flat between periods.

George
20-10-2008, 06:07 PM
That is not a function to use lol.
Pretty sure mail() is a function... (http://ca.php.net/manual/en/function.mail.php)

EDIT: Oh crap, Got mixed up :-P

Whitefang
20-10-2008, 07:06 PM
Bwahahaha, I pwn George with PHP knowledge xD

George
20-10-2008, 07:09 PM
Not the most effecient way, but thats cool lol

LavaEagle
21-10-2008, 01:12 AM
That isnt php, that's html.
your pretty on the ball aintcha?

LavaEagle
21-10-2008, 01:13 AM
That is not a function to use lol.

No field validation, not tested, gtg.
OK, tested, should work. Not the most efficient, but I think it's as efficient as it needs to be (and making it any more efficient would make it more complicated). And amazing that it functioned when I wrote it in ~5 minutes flat between periods.

Danke mein manner

now that i have this skeleton i can start getting it to email www.w3school.com (http://www.w3school.com) here i come.

Pink Floyd
21-10-2008, 03:09 AM
That isnt php, that's html.
your pretty on the ball aintcha?
[youtube:25iesfny]<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/s3KEkBqDahg&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/s3KEkBqDahg&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>[/youtube:25iesfny]

Robosmores
21-10-2008, 07:21 PM
Meant to be a pm, oops.