/    Sign up×
Community /Pin to ProfileBookmark

Creating a Simple web form

Can anyone please instruct me on how to create a simple web form with PHP? I am just looking for a text box and a submit button that sends an email to a specified address then clicked (and possibly then tells the user that the forum was sucessfully submitted). If anyone can help me with this it would be great. If it can’t be done with PHP can someone please tell me another possible method for creating web forms? Thanks a lot. ?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@tzenitoAug 06.2006 — redit: Zymic.com

Quote:

Step 1

Open a text editor like Notepad and copy/paste the following and save it as mail.php:

<?php

//variables (change these)

$youremail = "[email protected]";

// your email address

$subject = "Contact";

// the subject of the email

$thankyou = "thankyou.php";

// thank you page

// don't change anything else

if($email == ""){

?>

No email address added. Please go back.<br/>

<?php

}elseif($name == ""){

?>

No name added. Please go back.<br/>

<?php

}elseif($message == ""){

?>

No message added. Please go back.<br/>

<?php

}else{

$msg = ereg_replace("'", "'", $message);

$msg = ereg_replace('"', """, $msg);

$message1 = "from: $namenemail: $emailnmessage:n$msg1";

mail($youremail, $subject, $msg, "From: $emailrnReply-to: $emailrn");

?>

<meta http-equiv="refresh" content="0; url=<?echo $thankyou;?>"">

<?php

}

?>

Quote:

Step 2

Now for the form:

<form action="mail.php" method="post">

Name <input type="text" name="name"><br/>

Email addess <input type="text" name="email"><br/>

Message<br/>

<textarea name="message" cols="40" rows="5"></textarea><br/>

<input type="submit" value="send"><br/>

</form>


And thats it! You should have a simple contact form fully working.

Reply With Quote



http://psdforums.com/showthread.php?t=7
Copy linkTweet thisAlerts:
@DeadlyPersonaAug 23.2007 — I'm having the same issue as (bmass) mentioned in the start of this thread. I copied the response from (tzenito) and did exactly as instructed. But my file is in text format. Was I supposed to save it as .html or save it in a certain folder?
Copy linkTweet thisAlerts:
@BreanaAug 23.2007 — You need to save it as (mail.php) with the .php ext...

If you don't have a php editor, upload to the server and rename it with the .php ?

And upload it to the main directory, i just tested it nice thanks "tzenito"

You forgot to tell ppl that they also got to create 1 extra file: thankyou.php

I just put "Mail Sent..." in it lol.
Copy linkTweet thisAlerts:
@simonkAug 24.2007 — Can't get this to work. My server instructions say I need a php index page.

How secure from spam?

What I would really like is a script for a form that emails to me and sends a standard confirmation message to the filler in's email.

Or am I barking up the wrong tree and should I be using the mySQL database to do the same thing (a lot more complex perhaps ??)

Thanks

;-)
Copy linkTweet thisAlerts:
@simonkAug 24.2007 — Yes it is driving me demented - I have been through an education of Formmail,nms-Formmail, and blat.exe - can't seem to get any of them to work - php - the way forward? Frustrating!!
Copy linkTweet thisAlerts:
@DeadlyPersonaAug 24.2007 — When you get your answer please let me know. I'm still having an issue with it. The advice was to upload it to a server? What server?
×

Success!

Help @bmass spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...