Switch to full style
Dynamic open source server-side web development
Post a reply

Beginner needs help- simple 'mail_to' contact form in PHP

Tue Feb 17, 2009 11:25 pm

Hi all! ... I used TrendyFlash Site Builder to create a site, which generated a 'contact.php' file that I need to modify.
Basically it calls for the user to send a comment with a name, email id, subject and message. I need it to send those details to an external email id that I specify. Here's the script as generated by the software in that 'contact.php' file :

<!-- script starts here-->
<?

$contactfield1=$HTTP_GET_VARS["contactfield1"]
$contactfield2=$HTTP_GET_VARS["contactfield2"]
$contactfield3=$HTTP_GET_VARS["contactfield3"]
$contactfield4=$HTTP_GET_VARS["contactfield4"]

$email_from = "[email protected]";
$email_subject = "" ;
//$email_txt = "";
$email_to = "[email protected]";

$email_message = "field1: $contactfield1\n
field2 :$contactfield2 \n
field3 :$contactfield3 \n
field4 : $contactfield4 \n

";

mail($email_to, $email_subject, $email_message,$email_from);

?>

<!--script ends here-->

OK ... i went through some sample contact form scripts online and modified it like this :

<?php

// I should think the following 4 lines correspond to the 4 fields indicated in the screenshot attached at the end
// of this message

$contactfield1=$_POST["name"]
$contactfield2=$_POST["email_from"]
$contactfield3=$_POST["subject"]
$contactfield4=$_POST["comment"]

$email_from = "";
$subject = "" ;
//$email_txt = "";
$email_to = "my email id here";

$message = "field1: $contactfield1\n
field2 :$contactfield2 \n
field3 :$contactfield3 \n
field4 : $contactfield4 \n

";

mail($email_to, $subject, $message,$email_from);

?>

So is this right ? I uploaded it to test it, but it doesn't seem to work as I'm not getting anything in my email box.
If I can only get this script right, I can apply it to all future sites that I create using this software. So I just need to get it right once. This software isn't designed for scripting- PHP or otherwise, so it needs the user to know PHP if he wishes to go by that route (else I'd have to only publish the site to CD). Also if it requires any proper formatting (as some lines in the script seem to me to be out of place), then provide that too.

Any takers?

Regards,

C.

PS. In case yor interested, you can view the site as I created it at this link --> http://visitmyspace.sitegoz.com/
(just need that damn script to work!) :)



Attachments
contact.jpg
screenshot

Re: Beginner needs help- simple 'mail_to' contact form in PHP

Sun Sep 06, 2009 3:23 pm

usefull contactform

Re: Beginner needs help- simple 'mail_to' contact form in PHP

Sat Sep 12, 2009 1:07 am

yeah ... but it doesn't work for me as it's supposed to :(

Post a reply
  Related Posts  to : Beginner needs help- simple 'mail_to' contact form in PHP
 Adding a New Node to contact.xml     -  
 Beginner help on includes     -  
 I NEED SOME HELP IN THE FOR LOOP PLZ .. IAM JUST A BEGINNER     -  
 Hi im a beginner in java im facing problem please help me     -  
 php login form (sign-in form)     -  
 OpenGl simple example     -  
 php simple XML parser     -  
 Simple animation     -  
 Simple Calculator     -  
 Simple Light     -