Jump to content

Multiple fields in Form PHP/HTML to email... fail


Bloodmorphed

Recommended Posts

HTML code:

<form method="post" action="viewpage.php?page_id=5">

Email: <input name="email" type="text"><br>
Full Name: <input name="name" type="text"><br> 
Age: <input name="age" type="text"><br> 
Summoner Name: <input name="summon" type="text"><br> 
Do you have vent? <input name="vent" type="text"><br> 
Do you have a mic? <input name="mic" type="text"><br> 
How often can you be on? <input name="online" type="text"><br> 
What level are you? <input name="level" type="text"><br> 
Who do you like to play as? <input name="champs" type="text">
</form><br> 

Can you help donate to the clan for vent and the site?<br>
<textarea name="name" rows="7" cols="25"></textarea><br> 

Before you say anything about the PHP not scripted to do all fields, I already know this I'm trying to figure out how to send multiple ones in one message:

 

PHP Code:

<?php
if (isset($_POST['submit'])) {

  $to = "hidden for privacy";
  $subject = "LoL Recruitment";
  $email = $_REQUEST['email'] ;
  $message = ($_REQUEST['name'], $_REQUEST['age']) ;
  $headers = "From: $email";
  $sent = mail($to, $subject, $message, $headers) ;
  if($sent) {
print "Your mail was sent successfully";
}  else  {
print "We encountered an error sending your mail";
}
}
?> 

 

I'm willing to bet my

$message = ($_REQUEST['name'], $_REQUEST['age']) ;

if FAR wrong

Link to comment
Share on other sites

assign them to variables:

 

$name = $_POST['name'];
$age = $_POST['age'];

 

then in your $message you'd do this:

 

$message = '
Thank you '.$name.' , we see you are '.$age.' years old and are able to join.';

 

I'm not wanting to do it that way though, But I do see your point and i can customize that, so thanks, I'll see how it goes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.