Bloodmorphed Posted April 18, 2011 Share Posted April 18, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/234082-multiple-fields-in-form-phphtml-to-email-fail/ Share on other sites More sharing options...
Skewled Posted April 18, 2011 Share Posted April 18, 2011 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.'; Quote Link to comment https://forums.phpfreaks.com/topic/234082-multiple-fields-in-form-phphtml-to-email-fail/#findComment-1203133 Share on other sites More sharing options...
Bloodmorphed Posted April 18, 2011 Author Share Posted April 18, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/234082-multiple-fields-in-form-phphtml-to-email-fail/#findComment-1203134 Share on other sites More sharing options...
Skewled Posted April 18, 2011 Share Posted April 18, 2011 If you want to work with the $_POST array the you need to read: http://php.net/manual/en/reserved.variables.post.php In the first example submitted by a user you'll see how to do this. Give it a shot. Quote Link to comment https://forums.phpfreaks.com/topic/234082-multiple-fields-in-form-phphtml-to-email-fail/#findComment-1203138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.