Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Programming and Game Development (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=34)
-   -   php question (http://www.mysidiaadoptables.com/forum/showthread.php?t=2224)

maximillion 06-28-2011 06:34 PM

php question
 
what i am looking to accomplish:

i have a simple form where a user enters their email and clicks submit..

what i need is 1 php file that sends me an email containing their email address.. it doesn't need to give a thank you message or anything, just clear the box after submitting.

it can have like a popup box saying something like "Thank you, your email address has been submitted."

ruletka 06-28-2011 07:41 PM

Code:

<?php
 $theiremail = $_REQUEST['email'];
 $to = 'youremail@live.com';
 $fields = array();
 $fields{"email"} = "Email";
 $body = "\n\n"; foreach($fields as $a => $b){        $body .= sprintf("%20s: %

s\n",$b,$_REQUEST[$a]); }
 
 $headers2 = "From: $theiremail";
 $subject2 = "Someone contacted you";
 $autoreply = "".$theiremail."";
 
 if($theiremail == '') {print "You have not entered an email, please go

back and try again";}
 else {
 
 $send = mail($to, $subject2, $autoreply, $headers2);
 if($send)
 {header( "Location: http://www.site.com/thanks" );}
 else
 {print "We encountered an error, please notify

webmaster@YourCompany.com"; }
 }
?>

I got the code from http://php.about.com/od/phpapplicati...orm_mail_3.htm and I altered it.

maximillion 06-29-2011 06:24 AM

cool, i'll have to test it out.. ty :)

maximillion 06-29-2011 11:01 AM

didn't work on zymic hosting.. i'll have to try it on another host later today.

Nemesis 06-29-2011 02:40 PM

Quote:

Originally Posted by maximillion (Post 17325)
didn't work on zymic hosting.. i'll have to try it on another host later today.

:eye::eye::eye::eye::eye::eye::eye::eye::eye::eye:

Hall of Famer 06-29-2011 02:56 PM

umm Nemisis...

I dont think it makes any differences by switching to a different host, but its just me.

maximillion 06-29-2011 05:46 PM

i don't think script actually works.. and i'm sure it wasn't even tested before being posted... but at least ruletka tried

Tequila 06-29-2011 10:29 PM

I found my favorite contact form tutorial though in obscuro, there is one other I like at CSS Tricks (great site that one, another that I really recommend is Girls Who Geek (used to be Tutorialtastic and CodeGrrl)).

maximillion 06-30-2011 09:04 PM

cool.. ty - but ii just wanted a pre-made script ready for use with just the email and submit

Tequila 06-30-2011 09:10 PM

The one at CSS Tricks is downloadable, it's just in a neat container. :3 Maybe taking a look at it will make it easier to modify?


All times are GMT -5. The time now is 07:54 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.