Hello,
I’m new here, I’ve been into php for a few years now but only managed to have time to get back into it
i’m after having an enquiry form on my website so people can fill it in and i’ll get it sent to my email address
but the problem is, i can’t use strings and vars together
[php]<?php
if(!isset($_POST[‘postenquiry’])){
$content = 'If you would like to recieve a quote, then feel free to fill in this short form and we will get back to you as soon as possible.
<tr>
<td width="103" scope="col">Name:</td>
<th width="287" scope="col"><label for="name"></label>
<input type="text" name="name" id="name" />
</th>
</tr>
<tr>
<td>Number:</td>
<td><label for="number"></label>
<input type="text" name="number" id="number" /></td>
</tr>
<tr>
<td>Location:</td>
<td><label for="location"></label>
<input type="text" name="location" id="location" /></td>
</tr>
<tr>
<td>Message:</td>
<td><label for="message"></label>
<textarea name="message" cols="35" rows="5"></textarea></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="postenquiry" id="postenquiry" value="Submit" />
</form></td>
</tr>
';
echo $content;
}else{
$email = "
[email protected]";
$headers = "From:
[email protected]";
$subject = $_POST['name'];
$location = $_POST['location'];
$message = "This is your message: ".$_POST['message']."";
$number = $_POST['number'];
mail($email,$subject,$message,$headers);
$content = 'Done';
echo $content;
echo $message;
}
?>[/php]
the email sends just with data that’s in the message field, and not the string before it.
i’m also after doing the same thing with the subject of the email but it just gets info from the name field, even if i remove the $_POST[‘name’] from the “$subject” var
Any idea on whats wrong here?
Thank you guys