Jump to content

PHP Form


Howdy_McGee

Recommended Posts

Ok, I'm trying to get a PHP form to work but as soon as I put in the variable "$company" it just stop sending.... Doesn't give me a error or anything like that it just doesn't send it to my email.Obviously I've hidden my email in the below code:HTML

<form method="post" action="sendmail.php">  Your Name: <input name="name" type="text" size="70" /><br />  Company: <input name="company" type="text" size="70" /><br />  E-Mail: <input name="email" type="text" size="70" />  <br />  <br />  <textarea name="message" rows="15" cols="40">  </textarea><br />  <input type="submit" /></form>

PHP

<?php  $name = $_POST['name'];  $company = $_POST['company'];  $email = $_POST['email'];  $message = $_POST['message'];  mail( "hidden@email.com", "Feedback Form Results",	$name, $message, $company, "From: $email");  header( "Location: http://www.yahoo.com" );?>

Link to comment
Share on other sites

It is right, I'm not talking about the form, I'm talking about the mail function. The parameters are the to address, the subject, the body, additional headers, and additional parameters. Check the manual page. Anything you want in the email text goes in the body parameter.

Link to comment
Share on other sites

Check the manual page. Anything you want in the email text goes in the body parameter.
body parameter as in HTML body parameter? like in the PHP manual example?
$message = '<html><head>  <title>Birthday Reminders for August</title></head><body>  <p>Here are the birthdays upcoming in August!</p>  <table>	<tr>	  <th>Person</th><th>Day</th><th>Month</th><th>Year</th>	</tr>	<tr>	  <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>	</tr>	<tr>	  <td>Sally</td><td>17th</td><td>August</td><td>1973</td>	</tr>  </table></body></html>';

So I can still store data in variables that i create in PHP - I just need to put them in the body and store it all under '$message'?

Link to comment
Share on other sites

lol to be honest I'm a little surprised on how easy it is making a form with PHP.Are things like these necesseties?

enctype="multipart/form-data" accept-charset="UTF-8"

:) spoke too soon.I tried putting said variables into the PHP like so

$message = 'Name: ' $name;

And it will error out on that line. So I try to put it in HTML like so

$message ="<html>  <body>	<table>	  <tr>		<td>Name = 'Name:' $name</td>	  </tr>	</table>  </body></html>";

And it will also error out. What am I missing here?

Link to comment
Share on other sites

$message = 'Name: ' $name;

that will throw an error because you are missing the concatenation operator.

$message = 'Name: ' . $name;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...