Jump to content

Need help very badly.


Zaithe

Recommended Posts

Okay, well ive used a tutorial to do a form mail send thing. But it isnt working, when you press send it takes you to process.php, Heres what ive got the on the index (The form bit):

<form action="process.php" method="post">Username: <input type="text" name="username" size="30" maxlength="30" /><br />Password: <input type="text" name="password" size="30" maxlength="30" /><br />Real Name: <input type="text" name="realname" size="30" maxlength="30" /><br />E-Mail Address: <input type="text" name="email" size="30" maxlength="30" /><br /><input type="submit" name="submit" value="Send" /></form>

Okay that works, but when you press "Send" it takes you to process.php:

<?php@extract($_POST);$username = stripslashes($username);$password = stripslashes($password);$realname = stripslashes($realname);$email = stripslashes($email);mail('name@domain.com',$username,$password,"From: $realname <$email>");header("location:index.html");?>

It isnt meant to take me to that page, its mean to use process.php to send me the stuff that put in and then redirect them to index.html...but its not working...So, is it because ive saved the form as index.htm, do I have to save that as form.php or something? But if I do that, there won't be a index page. Oh my god im confused...please help...

Link to comment
Share on other sites

try changing your process.php to this:

<?php$recipient = "name@domain.com";$subject = "Subject of email here";$username = stripslashes($_POST['username']);$password = stripslashes($_POST['password']);$realname = stripslashes($_POST['realname']);$email = stripslashes($_POST['email']);// To send HTML mail, the Content-type header must be set$headers  = 'MIME-Version: 1.0' . "\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";// Additional headers$headers .= "To: ".$recipient . "\n";$headers .= "From: ".$email . "\n";$message = "username: ".$ username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;mail($recipient,$subject,$message,$headers);header("location: index.html");?>

edit: if youd like I can make it check that the email address is valid and I can a message stating if the mail was sucessfully sent or not.

Edited by calvin182
Link to comment
Share on other sites

the // stuff is just comments. you can post them, they are harmless. everything in that box, just copy it, and save it just like that (except you cange your recipient email address and subject) and save it as process.php.i hope that answers your question. i've subscribed to this thread so if you have any questions or anything ill get an email right away :)

Link to comment
Share on other sites

OMG DIDN'T WORK! When I press "Send" it takes me to "process.php" and just shows me whats on process.php...Maybe its something to do with the form on my index.htm?:

<form action="process.php" method="post">Username: <input type="text" name="username" size="30" maxlength="30" /><br />Password: <input type="text" name="password" size="30" maxlength="30" /><br />Real Name: <input type="text" name="realname" size="30" maxlength="30" /><br />E-Mail Address: <input type="text" name="email" size="30" maxlength="30" /><br /><input type="submit" name="submit" value="Send" /></form>

Anything wrong there? Or it might be my website is use to upload my files, I use atspace.com. Maybe I should use ripway.com? I need to get this working by the end of the day lol. =DThanks for the all help Calvin.

Link to comment
Share on other sites

well for starters, on atspace.com, there is nowhere on there that I see "php" listed. does it support php? the server must have it installed.secondly ripway.com supports "asp" and not "php" so I can't help you if you use that.thirdly, if you are certain that your server has php installed, there was an extra space in the process.php script (my spacebar is busted up hehe sorry) so here's the revised version. I tested it this time and it works perfectly.process.php:

<?php$recipient = "name@domain.com";$subject = "Subject of email here";$username = stripslashes($_POST['username']);$password = stripslashes($_POST['password']);$realname = stripslashes($_POST['realname']);$email = stripslashes($_POST['email']);// To send HTML mail, the Content-type header must be set$headers  = 'MIME-Version: 1.0' . "\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";// Additional headers$headers .= "To: ".$recipient . "\n";$headers .= "From: ".$email . "\n";$message = "username: ".$username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;mail($recipient,$subject,$message,$headers);header("location: index.html");?>

Link to comment
Share on other sites

My site is hosted free at roxr.com but currently they are not taking applications for free hosting because their server is getting full and they are waiting for the new one to arrive.I do not have one in specific to recommend to you, however, here is a list fo free PHP hosts that might be usefull:http://www.free-webhosts.com/free-php-webhosting.php

Link to comment
Share on other sites

could be something wrong with php.iniI once left a space (sendmail_from= username@domain.com) and it wouldn't work.. I never though of looking in the php.ini for the error until I sent php.ini to a friend because he needed a copy. If it's not in php.ini, it's in process.phpThis is an example of mine:

<?php// Get data from form $name = $_POST['name'];$website = $_POST['website'];$email = $_POST['email'];$comment = $_POST['comment'];$to = "username@domain.com";$subject = $_POST['subject'];// get the data ready to send$premessage = "$name \n $email \n $website \n $comment";$message = wordwrap($premessage, 70);$body = "$message \n ";// try to send the data, and print what happensif (mail($to, $subject, $body)){   echo("<p>Message successfully sent!<br>");}else{   echo("<p>Message delivery failed...</p>");}?>

When you go to process.php does it stop, or go to the next page. If it goes on put in my If statement. If it stops, turn on errors and tell us what they are!I can host a site for you, I have a form on my website... it will give you a folder. Then you can just get a domain or subdomain(redirector) and link to that folder.http://dcole.ath.cx.. I also have an easy to use File Manager (Copy, Duplicate, Move, Delete, Validate HTML/CSS, Create File/Folder, Upload, images in front of the filename...)

Link to comment
Share on other sites

this might be a good free PHP host for you:http://www.cabspace.com/ ● Instant Activation ● 100MB Disk Space ● 1 Gig/day Bandwidth ● Real 24/7 FTP ● Yourname.cabspace.com Web Address ● Online File Editor / Manager / Usage Stats ● Update or Remove Your Account Through the Profile Manager. ● Custom Control Panel ● Create Unlimited Directories ● Uploaded Files are Immediately Public ● Fast Tier-1 Direct Backbone Bandwidth Connections ● Robust Intel Hardware ● 99.99% Uptime ● Professional Level Support!plus it's ad free! :)

Link to comment
Share on other sites

Okay, ive got one of them. Before this thread dies can you tell me what this means:Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/www/website.awardspace.com/process.php on line 18

Link to comment
Share on other sites

sorry it seems i left my error in the fixed version accidentally, there, copy the last version I posted and it will work :)or if you wanna fix it yourself, change:

$message = "username: ".$ username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;

to:

$message = "username: ".$username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;

Link to comment
Share on other sites

It's works fine for me... I got the message in my gmail account instantly, but... just for the heck of it, lets modify this so we can see if there's an error before waiting forever.process.php:

<?php$recipient = "name@domain.com";$subject = "Subject of email here";$username = stripslashes($_POST['username']);$password = stripslashes($_POST['password']);$realname = stripslashes($_POST['realname']);$email = stripslashes($_POST['email']);// To send HTML mail, the Content-type header must be set$headers  = 'MIME-Version: 1.0' . "\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";// Additional headers$headers .= "To: ".$recipient . "\n";$headers .= "From: ".$email . "\n";$message = "username: ".$username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;if (mail($recipient,$subject,$message,$headers)) {echo "<h4>Your message was sent!</h4><div align=\"center\">Redirecting in 30 seconds<br/><a href=\"index.html\">Or, click here</a></div><div align=\"left\"><br/><br/><strong>recipient:</strong> $recipient<br/><strong>headers:</strong> $headers<br/><strong>subject:</strong> $subject<br/><strong>message:</strong><br/> $message</div><script language=\"javascript\">setTimeout(\"location.href=\'index.html\'\",30000);</script>";} else {echo "<h4>Sending Failure!</h4><div align=\"center\"><a href=\"index.htm\" rel=\"tag\" title=\"Return to form\">Return to form</a><br/><a href=\"index.html\" rel=\"tag\" title=\"Index\">Index</a></div>";};?>

This is not a fix, it simply will tell you if the message was sent or not, and present you with some link options. From what I understood in your above posts, the form is located on index.htm and you want it to redirect to index.html, so if theres an error you will get links to both of those locations. If the send is sucessfull, you will see a sucess message along with the content of the message and headers, and then the page will redirect in 30 seconds.In my trials, after the 30 second redirect my message arrives in my mailbox. Be sure to set your email address (preferably a gmail address if you have one, they show up in your inbox much faster than yahoo).

Link to comment
Share on other sites

Might be hotmail then, ill try that, =D--EDIT--OMG! FFS! It said "Sucessfull" when I tried it but I still haven't received the E-Mail! =(Maybe its something to do with my form?:

<form action="process.php" method="post">Username: <input type="text" name="username" size="30" maxlength="30" /><br />Password: <input type="text" name="password" size="30" maxlength="30" /><br />Real Name: <input type="text" name="realname" size="30" maxlength="30" /><br />E-Mail Address: <input type="text" name="email" size="30" maxlength="30" /><br /><input type="submit" name="submit" value="Send" /></form>

=(Maybe you could post a htm file of your own and ill view its source?

Link to comment
Share on other sites

it's not the form. the form has nothing to do with the address it is sent to. you have to set that address in the top of process.php, honestly, I think it's either you didn't set your email address in there or your email host's server is just slow. I suppose there could be a possibility that the server your files are on has somehow disabled the mail function. I really don't know. How about you change your email address in the process.php to mine and I'll see if I get anything from it. I'll send it to you in a PM.

Link to comment
Share on other sites

so far that's a no... but, reading over the mail() function on php.net, I've made some changes, I remember when I put this script together for my site it didnt work so I had to chage some things depending on the server type. This might work for you:process.php

<?php$recipient = "name@domain.com";$subject = "Subject of email here";$username = stripslashes($_POST['username']);$password = stripslashes($_POST['password']);$realname = stripslashes($_POST['realname']);$email = stripslashes($_POST['email']);// To send HTML mail, the Content-type header must be set$headers  = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers$headers .= "To: ".$recipient . "\r\n";$headers .= "From: ".$email . "\r\n";$message = "username: ".$username."<br/>password: ".$password."<br/>realname: ".$realname."<br/>email address: ".$email;if (mail($recipient,$subject,$message,$headers)) {echo "<h4>Your message was sent!</h4><div align=\"center\">Redirecting in 30 seconds<br/><a href=\"index.html\">Or, click here</a></div><div align=\"left\"><br/><br/><strong>recipient:</strong> $recipient<br/><strong>headers:</strong> $headers<br/><strong>subject:</strong> $subject<br/><strong>message:</strong><br/> $message</div><script language=\"javascript\">setTimeout(\"location.href=\'index.html\'\",30000);</script>";} else {echo "<h4>Sending Failure!</h4><div align=\"center\"><a href=\"index.htm\" rel=\"tag\" title=\"Return to form\">Return to form</a><br/><a href=\"index.html\" rel=\"tag\" title=\"Index\">Index</a></div>";};?>

Link to comment
Share on other sites

*sigh*...not working...It MUST be awardspace.com...First FreeWebs didn't accept mailto, then Ripway didn't except mailto so I moved onto PHP forms, then atspace didn't accept forms now awardspace says the send was succesfull but doesn't work...Ill have to find a peciffic website what allows PHP forms. Unless its something to do with the code.Ill go see if it works with a different thingy now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...