Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

61 users online



Sending email from same page

Sending email from same page

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 2
bleedwithme

bleedwithme

i do my crosswords in pen
Status: Offline!

Sending email from same page

I know how to use a form to send email, but I was wondering - How do I use one page for everything? I know it might have something to do with the isset function, but I'm really not sure where to start.

Any help would be greatly appreciated. Smile

jamiem

jamiem

Flying by the Seat of my Pants.
Status: Offline!
PHP:

<?php

if(isset($_POST['to']))
{
  
$to $_POST['to'];
  
$subject $_POST['subject'];
  
$message $_POST['message'];
  
$headers $_POST['headers'];

  
mail($to$subject$message$headers);
}

?>

Just change the isset() variable to a form name that you are posting and that shoudl work.

___________________

J

Last edited by jamiem, October 27th, 2005 09:34 PM (Edited 1 times)

bleedwithme

bleedwithme

i do my crosswords in pen
Status: Offline!

So if this is my HTML:

Code:

<form action="send.php" method="post">
<label for="textinput">Name:</label>
<br />
<input type="text" id="textinput" name="name" class="textinput" maxlength="25" />
<br />
<label for="passwordinput">Email</label>
<br />
<input type="text" id="passwordinput" name="email" class="textinput" maxlength="25" />
<br />
<br />
<label for="textareainput">Message:</label>
<br />
<textarea id="textareainput" name="message" class="textarea"></textarea>
<br />
<br />
<input type="submit" value="Submit" class="buttonSubmit" />
</form>

then I would change the isset() variable to 'submit', correct?

Last edited by bleedwithme, October 27th, 2005 10:23 PM (Edited 1 times)

kgx

kgx

Neverside Newbie
Status: Offline!

What I like to do is:

PHP:

<?php

if (count($_POST)>0){
     
// do error checking and stuff, etc. If no errors, success page; else tell user the errors.    
}

?>

I like to do really work through possible errors and hacks. From a user point of view, have a look at http://www.kgx.net.nz/contact.php and my work website http://www.kerrick.co.nz/contact.php (still improving this site).

Rad

Rad

thinking of something witty to put here
Status: Offline!

I do basically the same thing as kgx, but I think it is a bit more intuitive to do this:

PHP:

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
}

?>

valinorbob

valinorbob

Apathy is bliss.
Status: Offline!

There's always:

PHP:

<?php

if( !empty( $_POST ) ) {
    
//do process stuff here
}
?>

___________________

http://www.randomdeveloper.com/images/random_sig.jpg
"At least I shall die as I have lived, completely surrounded by morons."

TheClincher

TheClincher

Lost in Berkeley, CA
Status: Offline!

out of topic but hilarious avatar kgx

___________________

There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.

kgx

kgx

Neverside Newbie
Status: Offline!

Thanks Grin Made it myself Smile My avatar has been the main reason I got massive page views at deviantart Grin

bleedwithme

bleedwithme

i do my crosswords in pen
Status: Offline!

Animated avatars aren't allowed. Roll Eyes

Rad

Rad

thinking of something witty to put here
Status: Offline!
Originally posted by illEATurHARTout:

Animated avatars aren't allowed. Roll Eyes

He's right. Please change your avatar to something that is not animated.

Last edited by Rad, October 29th, 2005 02:19 AM (Edited 1 times)

Page 1 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0092 seconds.