Anyone know how to write PHP that can take values that a user inputs into a form on a webiste and the e-mail those values to myself. In other words how do i write PHP code for a Contact Us Form?
7 2189
What is your game here? You had the same question answered in the HTML forum http://www.thescripts.com/forum/thread578591.html and you were shown (by me) a PHP script that does exactly that! After that post there has been a full discussion in the HTML forum.
You are DOUBLE POSTING!
What is the reason you post the same question here?? Look at the mentioned reply-post and use it.
When you have a problem with it, state your problem, but don't start another new discussion!
Ronald :cool:
the ones posted there do not work, and ppl told me to move it to the PHP section, so I did. Also I'm trying to figure out but no one has posted anything for the past 3 days. My problem right now is really only about the PHP part, yet another reason why I started a new discussion.
So sorry if i made you mad, I didnt mean to its just that I need to get this done ASAP and I need some help.
Here is how I have done it.
First the form code:
[php]
<form action="email.p hp" method="post">
Name<br><input type="text" name="username" size="50">
<p style="text-align: center; font-family:arial, verdana, lucida, helvetica, sans-serif;font-size: 16px">
Email Address<br><inp ut type="text" name="useraddr" size="50">
<p style="text-align: center; font-family:arial, verdana, lucida, helvetica, sans-serif;font-size: 16px">
Comment<br>
<textarea name="comments" cols="50" rows="20"></textarea><br>
<input type="submit" value="Send Comment">
</form>
[/php]
And then the code that is executed when you click on "Send Comment":
[php]
<?php
$comments = $_POST['comments'];
$username = $_POST['username'];
$useraddr = $_POST['useraddr'];
$to = "destination@do main.com";
$re = "Website Comment Form";
$msg = $comments;
$headers = 'From: ' . $username . ' <' . $useraddr . '>' . "\r\n" .
'Reply-To: ' . $username . ' <' . $useraddr . '>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail( $to,$re,$msg,$h eaders );
?>
<html>
<head><title>Me sssage Received</title></head>
<body>
<center><h3 class=h16>Thank You For Your Comments</h3></center>
<p>
<center>Messa ge received from <?php echo( $username ); ?>
<br>
Reply to <?php echo( $useraddr ); ?></center>
</body>
</html>
[/php]
This is very basic but has worked for me. I need to beef it up with Captcha so bots can't exploit it
Atli 5,058
Recognized Expert Expert
Would I be wrong to assume you'd need an active mail service on you server to use the main() function?
What do you mean by "an active mail service"? You can install your own mail server or use an existing one. The latter is usually used. Only requirement is that your ISP allows you to send out mail (usually via port 25).
Ronald :cool:
Atli 5,058
Recognized Expert Expert
Yea thats what I thought,
not really sure wtf I was thinking when I wrote that :-P
Here is how I have done it.
First the form code:
[php]
<form action="email.p hp" method="post">
Name<br><input type="text" name="username" size="50">
<p style="text-align: center; font-family:arial, verdana, lucida, helvetica, sans-serif;font-size: 16px">
Email Address<br><inp ut type="text" name="useraddr" size="50">
<p style="text-align: center; font-family:arial, verdana, lucida, helvetica, sans-serif;font-size: 16px">
Comment<br>
<textarea name="comments" cols="50" rows="20"></textarea><br>
<input type="submit" value="Send Comment">
</form>
[/php]
And then the code that is executed when you click on "Send Comment":
[php]
<?php
$comments = $_POST['comments'];
$username = $_POST['username'];
$useraddr = $_POST['useraddr'];
$to = "destination@do main.com";
$re = "Website Comment Form";
$msg = $comments;
$headers = 'From: ' . $username . ' <' . $useraddr . '>' . "\r\n" .
'Reply-To: ' . $username . ' <' . $useraddr . '>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail( $to,$re,$msg,$h eaders );
?>
<html>
<head><title>Me sssage Received</title></head>
<body>
<center><h3 class=h16>Thank You For Your Comments</h3></center>
<p>
<center>Messa ge received from <?php echo( $username ); ?>
<br>
Reply to <?php echo( $useraddr ); ?></center>
</body>
</html>
[/php]
This is very basic but has worked for me. I need to beef it up with Captcha so bots can't exploit it
So I make this two different pages. One for the form and the other is with Message Recieved page?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jason |
last post by:
I'm struggling with this email code and I'm not php freak since I'm
starting to learn php stuff. Could use some help...
It seems that I get too many parse errors all over and cannot figure
went wrong since most of these appears right to me...
<?PHP
$to = "scoobyood@jace41.com" ;
$name = $_POST ;
|
by: Al Dykes |
last post by:
I'm going to be collecting lots (a few thousand) email addys. Each of
these people will be interested in recieving mail on one or more
topics, with an open ended and growing number of topics. Mailman with
a BD application behing it might be ideal as it would let users add
and delete themselves and each topic would have it's own email list
name identity.
Any suggestions for a PHP/mysql application to do this?>
Thanks
|
by: Serge Fournier |
last post by:
I would like to access the "contact" data in Outlook Express.
Which reference do I have to use ? (I was thinking at "Office").
Thanks
for any help
|
by: Matt |
last post by:
delicious has a bookmark you can add to your toolbar of this form:
javascript:location.href='http://del.icio.us/post?v=4;url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)
When you click it, it goes to your delicious account and lets you tag
the content, etc. Then it redirects you back to the page. I love that.
My javascript skills suck. But I'm reading this...
|
by: H5N1 |
last post by:
hi there
the topic says it all.
I have a outer join select statement in tableadapter that populates
GridView, I want to make it updatetable, so I need to provide an update
command for table adapter.
the problem is that not all rows in gridview exist in database (since
it's an outer join) so I want to UPDATE statement to insert the row if
it doesn't exist.
| |
by: popnbrown |
last post by:
Hey umm how do you write a form that e-mails to you?
I so far have created a form and some labels and textboxes
Here is the code:
<form name="contact" id="contact" method="put" action"#">
<label>Name: </label>
<p>
<input type="text" name="name" tabindex="1" class="ina"/>
</p>
<label>E-mail: </label>
|
by: kang jia |
last post by:
how can i do contact us page? use mail function ??hmm.. but when i click "contact us" navigation. it will link the mailbox. how to do this linkage?
i am quite new to PHP, maybe this problem seems simple to you, anyway, thanks for your kind help.
|
by: confusedfusion |
last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going into the URL string on a refresh of the form page.
I am very green on CF and CFM files and have this code below; I need to help for the error messages to "pop up" in a new window or display on the body of the page so anyone filling out the form knows...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |