PDA

View Full Version : Form


mex
01-11-2005, 07:03 AM
Recently the form i use for my site is acting really strange... i thought its because of my server but i guess there's some problem with something and i just figure it out...I have tried various form method but never seems to work...i know my server have php with the necessary setup for the form...

Can anyone show me a code to send just the name field and a password field to a specific email. Please

fci
01-11-2005, 09:37 AM
.. why don't you just post what you currently have so we can fix it? .. is there an error?

schotte
01-11-2005, 10:30 AM
Hey,

an easy example here:

form.html

<html>
...
<form method="post" action="processor.php" name="myForm">
Name: <input type="text" name="name" value=""><br />
Password: <input type="password" name="password" value=""><br />
<input type="submit" name="Send">
</form>
...
</html>


processor.php

<?php
if (!empty($_POST['name']) && !empty($_POST['password'])) {
$message = "Name: " . $_POST['name'] . "\nPassword: " . $_POST['password'];
mail("youremail@domain.tld", "Your subject", $message);
}
?>


Hope this helps.

Frank

Fou-Lu
01-12-2005, 02:24 AM
There is nothing wrong with your code, assuming that you have the correct email in there.
This will be caused by your server, and unfortunatly I'm not certain if you can do anything from your side to fix it. It would be best to contact your hosting company, some places use a different form of mailing than the regular mail() function, and you may need to set it up differently.