How do I change the subject field?
The subject is set on line 78 of the (unedited) contact form file & looks like this: $subject = "Automatic Form Email";
You can change the text between the " "
to anything you like, e.g. $subject = "Mail from contact form";
If you wish to use quotation marks in your subject line you must escape them with a backslash, e.g. $subject = "Mail from \"sitename\" contact form";
How do I let users specify a subject?
To let users specify an email subject, first you must add a subject field to your form. This can be a text field or a drop-down to restrict the choice to one of several.
First, find:
<label for="url">Website URL:</label>
<input type="text" name="url" id="url" value="<?php get_data("url"); ?>" /><br />
Underneath, add:
Text Field
<label for="subject">Subject:</label>
<input type="text" name="subject" id="subject" value="<?php get_data("subject"); ?>" /><br />
Or
Dropdown field
<label for="subject">Subject:</label>
<select name="subject" id="subject">
<option>Subject one</option>
<option>Subject two</option>
</select><br />
Add subject to required fields to ensure one is set: $requiredFields = "name,email,comments,subject";
& then change the subject to our receive the info from the form: $subject = stripslashes(strip_tags( $_POST['subject'] ));