I am making a simple registration form and cannot get one of the select fields to submit. My HTML and PHP all validates fine can anyone please help? My PHP looks like this:
<?php
$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
// Checkbox handling
$field_9_opts = $_POST['field_9'][0];
mail("me#mymail.co.uk","A message from the Website","A message from the Website:
Their name: " . $_POST['field_1'] . "
Their email address: " . $_POST['field_2'] . "
Their contact number: " . $_POST['field_3'] . "
The customer would prefer to be contacted: " . $_POST['field_4'] . "
The type of property the customer is interested in: " . $_POST['field_5'] . "
Their price range: " . $_POST['field_6'] . "
Their reason for purchase: " . $_POST['field_7'] . "
They heard about Parkway Newbury from: " . $_POST['field_8'] . "
Keep me updated on news on Parkway Living, Newbury: $field_9_opts
");
include("confirm.html");
?>
and my HTML looks like this:
<form method="post" enctype="multipart/form-data" action="processor.php">
<ul id="mainForm_1">
<li id="fieldBox_1">
<label>Your name *</label>
<input type="text" name="field_1" id="field_1" size="20" value="" />
</li>
<li id="fieldBox_2">
<label>Your email address *</label>
<input type="text" name="field_2" id="field_2" size="20" value="" />
</li>
<li id="fieldBox_3">
<label>Your contact number *</label>
<input type="text" name="field_3" id="field_3" size="20" value="" />
</li>
<li id="fieldBox_4">
<label>I would prefer to be contacted *</label>
<select name="field_4" id="field_4">
<option value="">Please select from the list</option>
<option value="In the morning">In the morning</option>
<option value="In the afternoon">In the afternoon</option>
<option value="In the evening">In the evening</option>
<option value="Anytime">Anytime</option>
</select>
</li>
<li id="fieldBox_5">
<label>Property type *</label>
<select name="field_5" id="field_5">
<option value="">Please select from the list</option>
<option value="Duplex">Duplex</option>
<option value="Apartment">Apartment</option>
<option value="Both">Both</option>
</select>
</li>
<li id="fieldBox_6">
<label>Prices from *</label>
<select name="field_6" id="field_6">
<option value="">Please select from the list</option>
<option value="upto £200,000">upto £200,000</option>
<option value="£200,000 - £300,000">£200,000 - £300,000</option>
<option value="£300,000 - £400,000">£300,000 - £400,000</option>
<option value="Above £400,000">Above £400,000</option>
</select>
</li>
<li id="fieldBox_7">
<label>Reason for purchase *</label>
<select name="field_7" id="field_7">
<option value="">Please select from the list</option>
<option value="Moving into the area">Moving into the area</option>
<option value="First time buyer">First time buyer</option>
<option value="Downsizing">Downsizing</option>
<option value="Need more space">Need more space</option>
</select>
</li>
<li id="fieldBox_8">
<label>Where did you hear about Parkway Living? *</label>
<select name="field_8" id="field_8">
<option value="">Please select from the list</option>
<option value="Website">Website</option>
<option value="National advertising">National Advertising</option>
<option value="Local advertising">Local Advertising</option>
<option value="Recommendation">Recommendation</option>
<option value="Selling agent">Selling agent</option>
<option value="Site visit">Site visit</option>
<option value="Other">Other</option>
</select>
</li>
<li id="fieldBox_9">
<label>Keep me updated on news on Parkway Living, Newbury *</label>
<span>
<input type="checkbox" name="field_9[]" id="field_9_option_1" value="yes" />
</span>
</li>
<li>
<input id="saveForm" type="submit" value="Submit" />
</li>
</ul>
</form>
The field that will not submit is field 8. I would appreciate any advice. Thanks in advance.
I copied and pasted your HTML in a simple template and it works like a charm. Sure you copied and pasted it correct?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="sv">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
</head>
<body>
<?php
if (!empty($_POST))
{
echo '<pre>';
print_r($_POST);
echo '</pre>';
}
?>
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<ul id="mainForm_1">
<li id="fieldBox_1">
<label>Your name *</label>
<input type="text" name="field_1" id="field_1" size="20" value="" />
</li>
<li id="fieldBox_2">
<label>Your email address *</label>
<input type="text" name="field_2" id="field_2" size="20" value="" />
</li>
<li id="fieldBox_3">
<label>Your contact number *</label>
<input type="text" name="field_3" id="field_3" size="20" value="" />
</li>
<li id="fieldBox_4">
<label>I would prefer to be contacted *</label>
<select name="field_4" id="field_4">
<option value="">Please select from the list</option>
<option value="In the morning">In the morning</option>
<option value="In the afternoon">In the afternoon</option>
<option value="In the evening">In the evening</option>
<option value="Anytime">Anytime</option>
</select>
</li>
<li id="fieldBox_5">
<label>Property type *</label>
<select name="field_5" id="field_5">
<option value="">Please select from the list</option>
<option value="Duplex">Duplex</option>
<option value="Apartment">Apartment</option>
<option value="Both">Both</option>
</select>
</li>
<li id="fieldBox_6">
<label>Prices from *</label>
<select name="field_6" id="field_6">
<option value="">Please select from the list</option>
<option value="upto £200,000">upto £200,000</option>
<option value="£200,000 - £300,000">£200,000 - £300,000</option>
<option value="£300,000 - £400,000">£300,000 - £400,000</option>
<option value="Above £400,000">Above £400,000</option>
</select>
</li>
<li id="fieldBox_7">
<label>Reason for purchase *</label>
<select name="field_7" id="field_7">
<option value="">Please select from the list</option>
<option value="Moving into the area">Moving into the area</option>
<option value="First time buyer">First time buyer</option>
<option value="Downsizing">Downsizing</option>
<option value="Need more space">Need more space</option>
</select>
</li>
<li id="fieldBox_8">
<label>Where did you hear about Parkway Living? *</label>
<select name="field_8" id="field_8">
<option value="">Please select from the list</option>
<option value="Website">Website</option>
<option value="National advertising">National Advertising</option>
<option value="Local advertising">Local Advertising</option>
<option value="Recommendation">Recommendation</option>
<option value="Selling agent">Selling agent</option>
<option value="Site visit">Site visit</option>
<option value="Other">Other</option>
</select>
</li>
<li id="fieldBox_9">
<label>Keep me updated on news on Parkway Living, Newbury *</label>
<span>
<input type="checkbox" name="field_9[]" id="field_9_option_1" value="yes" />
</span>
</li>
<li>
<input id="saveForm" type="submit" value="Submit" />
</li>
</ul>
</form>
</body>
</html>
Selecting the 2nd value (Website) generates this output:
Array
(
[field_1] =>
[field_2] =>
[field_3] =>
[field_4] =>
[field_5] =>
[field_6] =>
[field_7] =>
[field_8] => Website
)
So it works.
Your select name should be field_8[]
Related
Good morning,
I’m trying to display a div containing a form using PHP. I’m not using JavaScript because my teacher has told me to use PHP instead. I have two buttons and I’m using isset to determine which one is clicked. The functions execute and echo the correct identifying text, (“This is form X”), but the actual forms don’t display.
Initially, in CSS, the forms are displayed like so:
.parent .copyarea #formHELP {
display: none;
}
.parent .copyarea #formFEEDBACK {
display: none;
}
In HTML, they are the same. Class parent. Class copyarea. ID formFEEDBACK and formHELP. In PHP, this is the function I’m using:
<?php
echo "<h1> Hello PHP. </h1>";
if(isset($_GET['formHELPbutton'])) {
echo "Hello Form Help.";
echo "<div id='formHELP' style='display: block'>";
}
if(isset($_GET['formFEEDBACKbutton'])) {
echo "Hello Form Feedback.";
echo "<div id='formFEEDBACK' style='display: block'>";
}
?>
And like I mentioned, I"m getting the “Hello Form X”, so the function is working, but my echo div line is off somehow.
Please advise?
Thank you!
Edit: This is the entire content of the PHP echo statement, with the div inside:
if(isset($_GET['formHELPbutton'])) {
echo "Hello Form Help.";
echo '
<div id="formHELP">
<article>
<h1>Help Request Form</h1>
<form name="formHELP" action="http://cdlwebsysdev.esc-atsystems.net//WSD/form-to-email.php" onsubmit="return validateHELPForm()" method="post">
<p>Please take a moment to fill out and submit this help form. <br /></p>
<p>
<label for="FromAddressH">*Enter your email (required).</label>
<input type="text" id="FromAddressH" name="FromAddressH" minlength="5" maxlength="40" size="30"><br /><br />
<label for="telnumberH">Enter your telephone number.</label>
<input type="text" id="telnumberH" name="telnumberH" minlength="10" maxlength="20" size="30"><br /><br />
<label for="firstnameH">*Enter your first name (required).</label>
<input type="text" id="firstnameH" name="firstnameH" minlength="2" maxlength="20" size="20"><br /><br />
<label for="lastnameH">*Enter your last name (required).</label>
<input type="text" id="lastnameH" name="lastnameH" minlength="2" maxlength="30" size="30"><br /><br />
Your Mailing Address:
<br /><br />
<label for="streetH">Enter your street.</label>
<input type="text" id="streetH" name="streetH" minlength="2" maxlength="50" size="50"><br /><br />
<label for="cityH">Enter your city.</label>
<input type="text" id="cityH" name="cityH" minlength="2" maxlength="50" size="50"><br /><br />
<label for="stateH">Enter your state.</label>
<select id="stateH" name="stateH">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AR">AR</option>
<option value="AS">AS</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="GU">GU</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MP">MP</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="PR">PR</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="UM">UM</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="VI">VI</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select> <br /> <br />
<label for="postcodeH">Enter your postal code.</label>
Postal Code:
<input type="text" id="postcodeH" name="postcodeH" minlength="2" maxlength="10" size="10"><br /><br />
<label for="countryH">Enter your country code.</label>
Country Code:
<input type="text" id="countryH" name="countryH" minlength="2" maxlength="3" size="3"><br /><br />
<label for="helpH">*Please tell me what you require help with (required):</label>
<textarea name="helpH" id="helpH" rows="10" cols="80"></textarea> <br /> <br />
<br /> <br />
<div class="form-group options">
How would you like to be contacted? (Both boxes can be checked) :
<label for="contactphoneH">Phone</label>
<input type="checkbox" id="contactphoneH" name="contactphoneH">
<label for="contactemailH"> Email</label>
<input type="checkbox" id="contactemailH" name="contactemailH">
<br>
</div>
<br /> <br />
<input type="hidden" name="ToAddress" value="markholley4#gmail.com" /> <!-- TODO Change to todd.wolfe#esc.edu when final version published. -->
<input type="hidden" name="CCAddress" value="markholley4#gmail.com" />
<input type="hidden" name="Subject" value="WSD: Module 3 Assignment - Web Form for Mark Holley" />
<button type="submit" value="SubmitH">Submit</button>
<button type="reset" value="ResetH">Reset</button>
<br /> <br />
</form>
</article>
</div>';
Your Div elements needs a opening div tag( like you already have) but you are missing the closing one. Also if a div has no content, it won't have any width or height, so you won't see anything, you can test the code below, just added some color to the background so you can see the div.
`
if(isset($_GET['formHELPbutton'])) {
echo 'Hello Form Help.';
echo '<div id="formHELP" style="display:block; width:500px; height:500px; background-color:red">test form help </div>';
}
if(isset($_GET['formFEEDBACKbutton'])) {
echo 'Hello Form Feedback.';
echo '<div id="formFEEDBACK" style="display:block; width:500px; height:500px; background-color:red"> test form feedback </div>';
}
`
<div id="formHELP" style="display:block; width:500px; height:500px; background-color:red">test form help </div>
Hello i have a problem where my data isn't being put into my MYSQL database.
Also there isn't any errors at all on screen or in the php error page.
My code is below.
This is my array with all the data in
$time_submit = date('d/m/Y h:i:s a', time());
$submit_data = array(
'time_submit' => $time_submit,
'time_event' => $_POST['date'] . " " . $_POST['hr'] . ":" . $_POST['min'],
'project_number' => $_POST['project'],
'event' => $_POST['event'],
'happened' => $_POST['happened'],
'about_it' => $_POST['about_it'],
'reporter_name' => $_POST['reporter'],
'organisation' => $_POST['organisation'],
'trackside' => $_POST['trackside'],
'event_location' => $_POST['location'],
'phone_number' => $_POST['number'],
'yes_rules' => $_POST['rules'],
'life_rules' => $_POST['life_rules'],
'require_feedback' => $_POST['feedback'],
'reporter_email' => $_POST['email'],
'region' => $_POST['region'],
'photo' => $file_path
);
submit_form($submit_data);
I have a function that submits the data
function submit_form($submit_data) {
global $conn;
array_walk($submit_data, 'array_sanitize');
$fields = '`' . implode('`, `', array_keys($submit_data)) . '`';
$data = '\'' . implode('\', \'', $submit_data) . '\'';
mysqli_query($conn,"INSERT INTO tb_data($fields) VALUES($data)");
}
I have echoed everything to make sure its all okay and everything looks fine.
My form
<form id="closecall" action="<? echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" enctype="multipart/form-data">
<ul class="form">
<li><label><i>* Fields marked with an asterix are required</i></label></li><br />
<? echo output_errors($errors); ?>
<li><label for="date"><i>* </i>Event Date and time:<i class="required" id="datepicker_info">Required</i></label></li>
<li>
<input id="datepicker" type="text" name="date" >
<select name="hr" id="hr">
<option value="">Hr</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="00">00</option>
</select>
<select name="min" id="min">
<option value="">Min</option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select>
</li><br />
<li><label for="Project"><i>* </i>Involved Project:<i class="required" id="project_info">Required</i></label></li>
<li><input id="project" name="project" type="text"></li><br />
<li><label for="Event"><i>* </i>Describe the Event:<i class="required" id="event_info">Required</i></label></li>
<li><textarea class="textarea" id="event" name="event"></textarea></li><br />
<li><label for="happened"><i>* </i>What Could Have Happened:<i class="required" id="happened_info">Required</i></label></li>
<li><textarea class="textarea" id="happened" name="happened"></textarea></li><br />
<li><label for="about_it"><i>* </i>What were you able to do about it:<i class="required" id="about_info">Required</i></label></li>
<li><textarea class="textarea" id="about_it" name="about_it"></textarea></li><br />
<li><label for="reported">Reported By:</label></li>
<li><input id="reported" name="reporter" type="text"/></li><br />
<li><label for="organisation"><i>* </i>Organisation:<i class="required" id="organisation_info">Required</i></label></li>
<li><input id="organisation" name="organisation" type="text"></li><br />
<li><label for="trackside"><i>* </i>Trackside or Non-Trackside:</label></li>
<li>
<input type="radio" name="trackside" value="Trackside"><span>Trackside</span>
<input type="radio" name="trackside" value="Non-Trackside" checked><span>Non-Trackside including Civils and Aiports</span>
</li><br />
<li><label for="location">Other Location Info (Stand No./ELR/Mileage etc):</label></li>
<li class="optional"><span>(If Known)</span></li>
<li><input id="location" name="location" type="text"/></li><br />
<li><label for="number">Reporters Mobile Number:</label></li>
<li><input id="contact" name="number" type="text"/></li><br />
<li><label for="rules"><i>* </i>Potential Breach of Life Saving Rules? (Not Applicable to Airports):</label></li>
<li>
<input type="radio" name="rules" class="rules" value="Yes" ><span>Yes</span>
<input type="radio" name="rules" class="rules" value="No"checked><span>No</span>
</li><br />
<li class="liferules" style="display: none;"><label for="liferules"><i>* </i>Life Saving Rules (Not Applicable to Airports):<i class="required" id="rules_info">Required</i></label></li>
<li class="liferules" style="display: none;">
<select name="life_rules" id="liferules">
<option value="">Please Select!</option>
<option value="Working with electricity">Working with electricity</option>
<option value="Working with electricity-test before touch">Working with electricity-test before touch</option>
<option value="Always obey the speed limit and wear a seat belt.">Always obey the speed limit and wear a seat belt.</option>
<option value="Never use a hand-held or hands-free phone, or programme any other mobile device, while driving.">Never use a hand-held or hands-free phone, or programme any other mobile device, while driving.</option>
<option value="Working at height-without a harness">Working at height-without a harness</option>
<option value="Equipment fit for intended purpose">Equipment fit for intended purpose</option>
<option value="Under the influence of Drugs or Alcohol">Under the influence of Drugs or Alcohol</option>
<option value="Wasn't trained for the job at hand">Wasn't trained for the job at hand</option>
<option value="Entered exclusion zone(Without permission)">Entered exclusion zone(Without permission)</option>
<option value="Plans and Permits Weren't in place before Job">Plans and Permits Weren't in place before Job</option>
</select>
</li><br />
<li><label for="feedback"><i>* </i>Does the Reporter Require Close Call Feedback:</label></li>
<li>
<input type="radio" name="feedback" class="feedback" value="Yes" ><span>Yes</span>
<input type="radio" name="feedback" class="feedback" value="No" checked/><span>No</span>
</li><br />
<li class="email" style="display: none;"><label for="email"><i>* </i>Please enter your email address:<i class="required" id="feedback_info">Required</i></label></li>
<li class="email" style="display: none;"><input id="feedback" type="email" name="email"></li><br />
<li><label for="region"><i>* </i>Region:<i class="required" id="region_info">Required</i></label></li>
<li>
<select id="region" name="region">
<option value="">Please Select!</option>
<option value="Wales and Western">Wales and Western</option>
<option value="Central">Central</option>
<option value="Southern">Southern</option>
<option value="Airports">Airports</option>
</select>
</li><br />
<li><label><i>* Max 5MB Photos and PDF's only </i>Do you want to upload a file:</label></li>
<li>
<input type="radio" name="upload" value="Yes"><span>Yes</span>
<input type="radio" name="upload" value="No" checked/><span>No</span>
</li><br />
<li style="display: none;" class="fileload"><label for="image">File Upload:</label></li><br />
<li style="display: none;" class="fileload"><input id="file0" type="file" name="file1" ></li><br />
<li style="display: none;" class="fileload"><input name="button" type="button" value="Upload More"></li><br />
<li style="display: none;" class="fileshow"><input type="file" name="file2"></li>
<li style="display: none;" class="fileshow"><input type="file" name="file3"></li>
<li style="display: none;" class="fileshow"><input type="file" name="file4"></li>
<li style="display: none;" class="fileshow"><input type="file" name="file5"></li><br />
<li><i class="required" id="end_info">Please fill out required fields!</i></li>
<li><input id="submit" type="submit" value="Submit" ></li>
<li></li>
I know the way i do my time is wrong and i am going to change it.
Thanks
You should check for MySQL Error with mysqli_error
if (!mysql_query($conn, ...)) {
echo mysqli_error($conn);
}
I have a project (index.php) that is essentially a HTML webpage. I am trying to use an 'include' function to bring in the header and footer (header.php, footer.php). I'm also trying to have the current date automatically load in a textbox. While I believe the syntax for all of these are correct, no actual PHP statements seem to execute or get recognized. I discovered this by adding a simple echo statement to the page.
Can anyone give me advice? I'm at a loss.
HTML Input Value for date:
<p><label>Order Date:</label> <input value="<?php echo date('m/d/Y'); ?>" maxlength="20" size="10" name="txtOrderDate" type="text" pattern="\d{1,2}/\d{2}/\d{4}" required/></p>
Statements used for header/footer (difference obviously being file name, referenced first and last line of index.php):
<?php include '../view/header.php'; ?>`
Header.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- header -->
<head>
<title>Order Form</title>
<link rel="stylesheet" type="text/css" href="../view/main.css" />
</title>
</head>
Footer.php:
<div id="footer">
<p>
© <?php echo date("Y"); ?> Ordering Form
</p>
</div>
</body>
Index.php
(the beginning/end got broken up a bit, but I think everything is there)
<!-- include header -->
<?php require_once '../view/header.php'; ?>
<?php $today = date("m/d/Y"); ?>
<body>
<h1> Order Form </h1>
<div id="wrapper">
<form method="post" action="../model/A03_OrderForm.php">
<fieldset>
<!-- body -->
<body>
<div id="wrapper">
<form method="post" action="../model/A03_OrderForm.php">
<fieldset>
<div class="container">
<p><label>Order Date:</label> <input value="<?php echo $today; ?>" maxlength="20" size="10" name="txtOrderDate" type="date" pattern="\d{1,2}/\d{2}/\d{4}" required/></p>
</div></br>
<div class="container">
<p><label>Salutation:</label> <select name="selSalutation"> <option selected="selected" value="">(none)</option><option value="Mr">Mr.</option><option value="Mrs">Mrs.</option><option value="Ms">Ms.</option><option value="Miss">Miss</option><option value="Dr">Dr.</option></select></p>
<p><label>First Name:</label> <input maxlength="20" name="txtFirstName" type="text" pattern="[A-Za-z]+" required/></p>
<p><label>Middle Initial:</label> <input maxlength="1" size="2" name="txtMiddleInit" pattern="[A-Za-z]" "type="text" /></p>
<p><label>Last Name:</label> <input maxlength="20" name="txtLastName" type="text" pattern="[A-Za-z]+" required/></p>
<p><label>Suffix:</label> <select name="selSuffix"> <option selected="selected" value="">(none)</option><option value="Jr">Jr</option><option value="Sr">Sr</option><option value="I">I</option><option value="II">II</option><option value="III">III</option><option value="IV">IV</option><option value="V">V</option></select></p>
</div></br>
<div class="container">
<p><label>Address:</label> <input maxlength="30" size="36" name="txtAddress" type="text" required/></p>
<p><label>City:</label> <input maxlength="20" name="txtCity" type="text" pattern="[A-Za-z0-9\s]+" required/></p>
<p><label>State:</label> <select name="selState"> <option selected="selected" value="DEFAULT">(none)</option> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="GU">GU</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option></select></p>
<p><label>Postal Code:</label> <input maxlength="10" size="14" name="txtPostalCode" type="text" pattern="[0-9]{5}" required/></p>
</div></br>
<div class="container">
<p><label>Item No:</label> <input value="01" maxlength="30" name="txtItem" type="number" required/></p>
<p><label>Quantity:</label> <input value="0" maxlength="20" size="14" name="txtQuantity" type="number" required/></p>
<p><label>Price:</label> <input value="0.00" maxlength="50" size="14" name="txtPrice" type="number" step="0.01" required/></p>
</div></br>
<div class="submit"><input class="button" value="Submit" type="submit" name="btnSubmit" /> <input class="button" value="Reset" type="reset" name="btnReset" />
<div></div>
</div>
</form>
</fieldset></div>
<!-- include footer -->
<?php require_once '../view/footer.php'; ?>
As a reminder, none of the PHP statements execute on screen.
Thanks for the input thus far.
One thing to add is the webpage loads and operates just fine except the header/footer are not included (therefore no CSS either) and the date does not load in the textbox. Beyond those two things, it's golden.
ANSWERS TO COMMENTS:
Using XAMPP and Notepad++
Local
Not sure what is meant by the verbatim comment. When I view the source code from the page it is exactly as written in my text editor?
<?php $today = date("m.d.y"); ?>
<p><label>Order Date:</label> <input value="<?php echo $today; ?>" name="txtOrderDate" type="date"></p>
try like this
2nd
make new php file (time.php) copy code from here to it run it on your pc
<?php
$today = date("m.d.y"); // 03.10.01
echo = $today;
?>
is that work?
I think that beater solution is to use date picker for this u will not have problem in future how user use date m.d.y m/d/y and so on.
and if possible can u share all code?
Solved! I copied the text from 'index.php', deleted the file, and pasted it onto a new sheet. The textbox value loads today's date and the header/footer were successfully displayed.
Thank you all for the replies and ideas. Greatly appreciated!
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Link to basic functions file:
<?php require_once("functions.inc"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" type="type/css" href="form.css"/>
<title>Registration Page</title>
</head>
<body>
<form id="userForm" method="POST" action="register-process.php">
<div>
Registration Page:
<fieldset>
<legend>Registration Information</legend>
<div id="errorDiv">
<?php
if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) {
unset($_SESSION['formAttempt']);
print "Errors encountered<br />\n";
foreach ($_SESSION['error'] as $error) {
print $error . "<br />\n";
} //end foreach
?>
</div>
Registration Page Fields:
<label for="fname">First Name:* </label>
<input type="text" id="fname" name="fname" />
<span class="errorFeedback errorSpan"
id="fnameError"> First Name is required</span>
<br />
<label for="lname">Last Name:* </label>
<input type="text" id="lname" name="lname">
<span class="errorFeedback errorSpan"
id="lnameError">Last Name is required</span>
<br />
<label for="email">E-mail Address:*</label>
<input type="text" id="email" name="email">
<span class="errorFeedback errorSpan"
id="emailError">E-mail is required</span>
<br />
<label for="password1">Password:*</label>
<input type="password" id="password1" name="password1"> <span class="errorFeedback errorSpan"
id="password1Error">Password required</span>
<br />
<label for="password2">Verify Password:*</label>
<input type="password" id="password2" name="password2">
<span class="errorFeedback errorSpan"
id="password1Error">Password required</span>
<br />
<label for="addr">Address: </label>
<input type="text" id="addr" name="addr">
<br />
<label for="city">City:</label>
<input type="text" id="city" name="city">
<br />
<label for="county">County:</label>
<select name="county" id="county">
<option></option>
<option value="Avon">Avon</option>
<option value="Bedfordshire">Bedfordshire</option>
<option value="Berkshire">Berkshire</option>
<option value="Borders">Borders</option>
<option value="Buckinghamshire">Buckinghamshire</option>
<option value="Cambridgeshire">Cambridgeshire</option>
<option value="Central">Central</option>
<option value="Cheshire">Cheshire</option>
<option value="Cleveland">Cleveland</option>
<option value="Clwyd">Clwyd</option>
<option value="Cornwall">Cornwall</option>
<option value="County Antrim">County Antrim</option>
<option value="County Armagh">County Armagh</option>
<option value="County Down">County Down</option>
<option value="County Fermanagh">County Fermanagh</option>
<option value="County Londonderry">County Londonderry</option>
<option value="County Tyrone">County Tyrone</option>
<option value="Cumbria">Cumbria</option>
<option value="Derbyshire">Derbyshire</option>
<option value="Devon">Devon</option>
<option value="Dorset">Dorset</option>
<option value="Dumfries and Galloway">Dumfries and Galloway</option>
<option value="Durham">Durham</option>
<option value="Dyfed">Dyfed</option>
<option value="East Sussex">East Sussex</option>
<option value="Essex">Essex</option>
<option value="Fife">Fife</option>
<option value="Gloucestershire">Gloucestershire</option>
<option value="Grampian">Grampaign</option>
<option value="Greater Manchester">Greater Manchester</option>
<option value="Gwent">Gwent</option>
<option value="Gwynedd County">Gwynedd County</option>
<option value="Hampshire">Hampshire</option>
<option value="Herefordshire">Herefordshire</option>
<option value="Hertfordshire">Hertfordshire</option>
<option value="Highlands and Islands">Highlands and Islands</option>
<option value="Humberside">Humberside</option>
<option value="Isle of Wight">Isle of Wight</option>
<option value="Kent">Kent</option>
<option value="Lancashire">Lancashire</option>
<option value="Leicestershire">Leicestershire</option>
<option value="Lincolnshire">Licolnshire</option>
<option value="Lothian">lothian</option>
<option value="Merseyside">Merseyside</option>
<option value="Mid Glamorgan">Mid Glamorgan</option>
<option value="Norfolk">Norfolk</option>
<option value="North Yorkshire">North Yorkshire</option>
<option value="Northamptonshire">Northhamptonshire</option>
<option value="Northumberland">Northumberland</option>
<option value="Nottinghamshire">Nottinghamshire</option>
<option value="Oxfordshire">Oxforshire</option>
<option value="Powys">Powys</option>
<option value="Rutland">Rutland</option>
<option value="Shropshire">Shropshire</option>
<option value="Somerset">Somerset</option>
<option value="South Glamorgan">South Glamorgan</option>
<option value="South Yorkshire">South Yorkshire</option>
<option value="Staffordshire">Staffordshire</option>
<option value="Strathclyde">Strathclyde</option>
<option value="Suffolk">Suffolk</option>
<option value="Surrey">Surrey</option>
<option value="Teesside">Teesside</option>
<option value="Tyne and Wear">Tyne and Wear</option>
<option value="Warwickshire">Warwickshire</option>
<option value="West Glamorgan">West Glamorgan</option>
<option value="West Midlands">West Midlands</option>
<option value="West Sussex">West Sussex</option>
<option value="West Yorkshire">West Yorkshire</option>
<option value="Wiltshire">Wiltshire</option>
<option value="Worcestershire">Worcestershire</option>
</select>
<br />
<label for="postcode">Postcode:</label>
<input type="text" id="postcode" name="postcode">
<br />
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone">
<span class="errorFeedback errorSpan"
id="phoneError">Format: xxxx-xxx-xxxx</span>
<br />
<br />
<label for="mobile"> Number Type:</label>
<input class="radioButton" type="radio"
name="phonetype" id="mobile" value="mobile">
<label class="radioButton" for="mobile">Mobile</label>
<input class="radioButton" type="radio"
name="phonetype" id="home" value="home">
<label class="radioButton" for="home">Home</label>
Syntax error is apparently on this line according to Dreamweaver and the error was present from early on when writing the code and moved to the to the newer span class when a new one was added:
<span class="errorFeedback errorSpan phoneTypeError"
id="phonetypeError">Please choose an option</span>
<br />
<input type="submit" id="submit" name="submit">
</fieldset>
</div>
</form>
</body>
When I attempt to view this page in a web browsers it suggests that there are issues with the last line:
</html>
I have looked for errors but came seem to find any clear ones!
Hope I'm not being stupid
You are using this twice
<span class="errorFeedback errorSpan" id="password1Error">Password required</span>
Remove one instance of that....
Secondly , you forgot to close a brace for your if. Close it like this
<?php
if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) {
unset($_SESSION['formAttempt']);
print "Errors encountered<br />\n";
foreach ($_SESSION['error'] as $error) {
print $error . "<br />\n";
} //end foreach
}//<----- Add here
?>
add last brackets in your php code. because you use if statement and foreach..
<?php
if() {
//enter code here
foreach() {
//enter code here
}
}
?>
You're missing the closing bracket of your IF statement:
<?php
if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) {
unset($_SESSION['formAttempt']);
print "Errors encountered<br />\n";
foreach ($_SESSION['error'] as $error) {
print $error . "<br />\n";
} //end foreach
} // <-- MISSING
?>
I have created a form on our website for an online submission of claims for our work. I have two pages associated with the form. I have a back end .php page with a thank you for submission and the code to POST an e-mail to our business address. When the form is filled out, and then submitted, we are not recieving an e-mail. I am pretty new to coding and this is my first attempt at creating a form. I thought I had the necessary code and .php to do this. I would really appreciate any input on how to make this form come through in an e-mail. My form page appears as such:
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="Templates/main_page.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Assignment Submission</title>
<!--[if lte IE 9]>
<style type="text/css" title="ie-style-css">
/* lte IE 9 style*/
</style>
<![endif]-->
<!-- InstanceEndEditable -->
<link href="stylesheets/reset.css" rel="stylesheet" type="text/css" />
<link href="stylesheets/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/browser-compatibility.js"></script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script type="text/javascript" src="http://cdn.wibiya.com/Toolbars/dir_1424/Toolbar_1424727/Loader_1424727.js"></script>
</head>
<body>
<noscript>
Web Toolbar by Wibiya
</noscript>
<div class="main_wrapper cf">
<div class="header cf">
<div class="logo_holder cf"></div>
<div class="nav_holder cf">
<ul class="hmenubar cf">
<li>Home </li>
<li>About </li>
<li>Services </li>
<li>coverage </li>
<li>submit an assignment </li>
<li>Resources </li>
<li>Contact </li>
<script type="text/javascript" src="scripts/menu_selection.js"></script>
</ul>
</div>
</div>
<div class="content cf"> <!-- InstanceBeginEditable name="ContentRegion" -->
<div class="column_1">
<h2 class="about">Assignment Submission Form</h2>
<h2 class="service_text"><font color="#FF0000">PLEASE BE AWARE WE ARE EXPERIENCING DIFFICULTIES WITH OUR ONLINE SUBMISSION FORM. PLEASE CONTACT US TO PROVIDE US WITH AN ASSIGNMENT AT THIS TIME. (xxx) xxx-xxxx. Thank you.</font><br />
Please complete as many fields as possible and click submit at the bottom of the page. We will contact you with a confirmation. If you do not hear from us within 2 hours of submission, please contact us. </h2>
<form id="new_assignment" name="Assignment Form" method="post" action="result.php" class="assign_form">
<hr />
<h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Client Information</h1>
<hr />
<p class="paragraph2">
<label>Company Name:</label>
<input name="company" type="text" required="required" form="new_assignment" tabindex="1" style="width:225px" />
<br/>
<label>Adjuster:</label>
<input name="adj" type="text" required="required" form="new_assignment" tabindex="2" style="width:200px" />
<label>E-mail:</label>
<input name="email" type="email" required="required" form="new_assignment" tabindex="3" style="width:250px" />
<br/>
<label>Phone Number:</label>
<input name="adj_phone_number" type="tel" required="required" form="new_assignment" tabindex="4" style="width:100px" />
<label>Extension:</label>
<input name="ext" type="text" form="new_assignment" tabindex="5" style="width:40px" />
<label>Fax Number:</label>
<input name="fax" type="tel" form="new_assignment" tabindex="6" style="width:100px" />
</p>
<hr />
<div class="claim_info">
<h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Claim Information</h1>
<hr />
<p class="paragraph2">
<label>Assignment Type:</label>
<select name="assign_type" form="new_assignment" tabindex="7" title="Assignment Type">
<option value="auto" selected="selected">Automobile</option>
<option value="rec">Recreational</option>
<option value="heavy">Heavy Equipment</option>
<option value="property">Minor Property</option>
<option value="audit">Estimate Audit</option>
<option value="scene_invest">Scene Investigation</option>
<option value="arb">Arbitration</option>
<option value="DRP">DRP Quality Control Inspection</option>
<option value="photos">Photos Only</option>
</select>
<label>Type of Loss:</label>
<select name="loss_type" form="new_assignment" tabindex="8" title="Loss Type">
<option value="coll">Collision</option>
<option value="comp">Comprehensive</option>
<option value="other">Other</option>
</select>
<br/>
<label>Claim #:</label>
<input name="claim_#" type="text" required="required" form="new_assignment" tabindex="9" style="width:225px" />
<label>Policy #:</label>
<input name="policy_#" type="text" form="new_assignment" tabindex="10" style="width:150px" />
<br/>
<label>Deductible: </label>
<input name="deductible" type="text" form="new_assignment" tabindex="11" style="width:100px" />
<label>Date of Loss: </label>
<input name="dol" type="date" form="new_assignment" tabindex="12" style="width:150px" />
<br />
</p>
<div class="insd_info">
<label>Insured:</label>
<input name="insured" type="text" required="required" form="new_assignment" tabindex="13" style="width:200px" />
<br/>
<label>Address:</label>
<input name="insd_address" type="text" form="new_assignment" tabindex="14" style="width:275px" />
<br/>
<label>City:</label>
<input name="insd_city" type="text" form="new_assignment" tabindex="15" style="width:120px" />
<label>State:</label>
<select name="insd_state" form="new_assignment" tabindex="16" title="Insured State">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI" selected="selected">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select>
<br/>
<label>Zip Code:</label>
<input name="insd_ZIP" type="text" form="new_assignment" tabindex="17" style="width:130px" />
<br/>
<label>Home Phone:</label>
<input name="insd_home" type="tel" form="new_assignment" tabindex="18" style="width:140px" />
<br/>
<label>Work Phone:</label>
<input name="insd_work" type="tel" form="new_assignment" tabindex="19" style="width:140px" />
<br/>
<label>Mobile Phone:</label>
<input name="insd_mobile" type="tel" form="new_assignment" tabindex="20" style="width:140px" />
<br/>
<label>Other Phone:</label>
<input name="insd_other" type="tel" form="new_assignment" tabindex="21" style="width:140px " />
<br/>
</div>
<div class="claimant_info ">
<label>Claimant:</label>
<input name="claimant " type="text " required="required " form="new_assignment " tabindex="22" style="width:200px " />
<br/>
<label>Address:</label>
<input name="claimant_address " type="text " form="new_assignment " tabindex="23" style="width:275px " />
<br/>
<label>City:</label>
<input name="claimant_city " type="text " form="new_assignment " tabindex="24" style="width:120px " />
<label>State:</label>
<select name="claimant_state " form="new_assignment " tabindex="25" title="Claimant State ">
<option value="AL ">AL</option>
<option value="AK ">AK</option>
<option value="AZ ">AZ</option>
<option value="AR ">AR</option>
<option value="CA ">CA</option>
<option value="CO ">CO</option>
<option value="CT ">CT</option>
<option value="DE ">DE</option>
<option value="FL ">FL</option>
<option value="GA ">GA</option>
<option value="HI ">HI</option>
<option value="ID ">ID</option>
<option value="IL ">IL</option>
<option value="IN ">IN</option>
<option value="IA ">IA</option>
<option value="KS ">KS</option>
<option value="KY ">KY</option>
<option value="LA ">LA</option>
<option value="ME ">ME</option>
<option value="MD ">MD</option>
<option value="MA ">MA</option>
<option value="MI " selected="selected">MI</option>
<option value="MN ">MN</option>
<option value="MS ">MS</option>
<option value="MO ">MO</option>
<option value="MT ">MT</option>
<option value="NE ">NE</option>
<option value="NV ">NV</option>
<option value="NH ">NH</option>
<option value="NJ ">NJ</option>
<option value="NM ">NM</option>
<option value="NY ">NY</option>
<option value="NC ">NC</option>
<option value="ND ">ND</option>
<option value="OH ">OH</option>
<option value="OK ">OK</option>
<option value="OR ">OR</option>
<option value="PA ">PA</option>
<option value="RI ">RI</option>
<option value="SC ">SC</option>
<option value="SD ">SD</option>
<option value="TN ">TN</option>
<option value="TX ">TX</option>
<option value="UT ">UT</option>
<option value="VT ">VT</option>
<option value="VA ">VA</option>
<option value="WA ">WA</option>
<option value="WV ">WV</option>
<option value="WI ">WI</option>
<option value="WY ">WY</option>
</select>
<br/>
<label>Zip Code:</label>
<input name="claimant_ZIP " type="text " form="new_assignment " tabindex="26" style="width:130px " />
<br/>
<label>Home Phone:</label>
<input name="claimant_home " type="tel " form="new_assignment " tabindex="27" style="width:140px " />
<br/>
<label>Work Phone:</label>
<input name="claimant_work " type="tel " form="new_assignment " tabindex="28" style="width:140px " />
<br/>
<label>Mobile Phone:</label>
<input name="claimant_mobile " type="tel " form="new_assignment " tabindex="29" style="width:140px " />
<br/>
<label>Other Phone:</label>
<input name="claimant_other" type="tel" form="new_assignment" tabindex="30" style="width:140px" />
</div>
</div>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br />
<hr />
<h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Vehicle Information</h1>
<hr />
<p class="paragraph2">
<label>Owner of vehicle to be inspected: </label>
<select name="owner_type" form="new_assingments" tabindex="31" style="width:160px">
<option value="insd" selected="selected">Insured</option>
<option value="clmt">Claimant</option>
</select>
<br />
<label>Year: </label>
<input name="veh_year" type="text" for="new_assignment" tabindex="32" style="width:80px" />
<label>Make: </label>
<input name="veh_make" type="text" form="new_assignment" tabindex="33" style="width:100px" />
<label>Model: </label>
<input name="veh_model" type="text" form "new_assigment" tabindex="34" style="width:100px" />
<label>Color: </label>
<input name="veh_color" type="text" form="new_assignment" tabindex="35" style="width:100px" />
<br/>
<label>VIN: </label>
<input name="veh_VIN" type="text" form="new_assignment" tabindex="36" style="width:200px" />
<label>License Plate: </label>
<input name="lic_plate" type="text" form="new_assignment" tabindex="37" style="width:100px" />
<label>State:</label>
<select name="license_state " form="new_assignment " tabindex="38" title="License State ">
<option value="AL ">AL</option>
<option value="AK ">AK</option>
<option value="AZ ">AZ</option>
<option value="AR ">AR</option>
<option value="CA ">CA</option>
<option value="CO ">CO</option>
<option value="CT ">CT</option>
<option value="DE ">DE</option>
<option value="FL ">FL</option>
<option value="GA ">GA</option>
<option value="HI ">HI</option>
<option value="ID ">ID</option>
<option value="IL ">IL</option>
<option value="IN ">IN</option>
<option value="IA ">IA</option>
<option value="KS ">KS</option>
<option value="KY ">KY</option>
<option value="LA ">LA</option>
<option value="ME ">ME</option>
<option value="MD ">MD</option>
<option value="MA ">MA</option>
<option value="MI ">MI</option>
<option value="MN ">MN</option>
<option value="MS ">MS</option>
<option value="MO ">MO</option>
<option value="MT ">MT</option>
<option value="NE ">NE</option>
<option value="NV ">NV</option>
<option value="NH ">NH</option>
<option value="NJ ">NJ</option>
<option value="NM ">NM</option>
<option value="NY ">NY</option>
<option value="NC ">NC</option>
<option value="ND ">ND</option>
<option value="OH ">OH</option>
<option value="OK ">OK</option>
<option value="OR ">OR</option>
<option value="PA ">PA</option>
<option value="RI ">RI</option>
<option value="SC ">SC</option>
<option value="SD ">SD</option>
<option value="TN ">TN</option>
<option value="TX ">TX</option>
<option value="UT ">UT</option>
<option value="VT ">VT</option>
<option value="VA ">VA</option>
<option value="WA ">WA</option>
<option value="WV ">WV</option>
<option value="WI ">WI</option>
<option value="WY ">WY</option>
</select>
<br/>
<label>Description of Loss: </label>
<textarea name="desc_of_loss" id="desc_of_loss" form="new_assignment" tabindex="39" style="width:500px"></textarea>
<br />
<label>Description of Damage: </label>
<textarea name="desc_of_dmg" id="desc_of_dmg" form="new_assignment" tabindex="40" style="width:500px"></textarea>
<br />
</p>
<hr />
<h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Vehicle Location</h1>
<hr />
<p class="paragraph2">
<label>Location Name: </label>
<input name="location_name" type="text" form="new_assignment" style="width:250px" tabindex="41" value="With Owner" />
<br />
<label>Address: </label>
<input name="location_address" type="text" form="new_assignment" style="width:300px" tabindex="42" value="(same as owner above)" />
<br />
<label>City:</label>
<input name="insd_city" type="text" form="new_assignment" tabindex="43" style="width:120px" />
<label>State:</label>
<select name="insd_state" form="new_assignment" tabindex="44" title="Insured State">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI" selected="selected">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select>
<br/>
<label>Zip Code: </label>
<input name="insd_ZIP" type="text" form="new_assignment" tabindex="45" style="width:130px" />
<label>Contact: </label>
<input name="location_contact" type="text" form="new_assignment" tabindex="46" style="width:150px" />
<br/>
</p>
<hr />
<input type="reset" class="button" />
<input name="submit" type="submit" class="button" form="new_assignment" formaction="/result.php" formenctype="multipart/form-data" formmethod="POST" value="Submit" />
<p></p>
<div class="important" id="important">
<label>Trojan</label>
<input type="text" name="trojan" id="trojan" />
</div>
</form>
</div>
<!-- InstanceEndEditable --> </div>
<div class="footer cf">
<p class="rights">LMC Insurance Services, INC - 2013 All Rights Reserved | <a class="privacy" href="/privacy_policy.html" target="_self">Privacy Policy</a> </p>
</div>
</div>
</body>
<!-- InstanceEnd -->
</html>
And my .php results page appears as:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Submission</title>
</head>
<body>
<?PHP
//checks if bot
if($_POST['trojan']!='');
die("Changed field");
$adj = $_POST['adj'];
$company = $_POST['company'];
$email = $_POST['email'];
$adj_phone = $_POST['adj_phone_number'];
$ext = $_POST['ext'];
//Sending Email to form owner
$header = "From: $email\n"
. "Relpy-To: $email\n";
$subject = "New Assignment from Website";
$email_to = "office#example.com";
$message = "We recieved a new assignment from $adj \n"
. "They can be reached at $adj_phone $ext \n"
. "Their e-mail address is $email \n";
mail($email_to,$subject,$message,$header);
?>
<h1>Thank you for your submission!</h1>
<p>Your information has been sent, and our office will contact you to verify the assignment and confirm any special instructions.</p>
<p>We thank you for utilizing our services. We hope to complete your assignment in a timely manner.</p>
</body>
</html>
Any and all help is greatly appreciated.
remove the ; from
if($_POST['trojan']!='');
^
here
because I think this following statement is executed every time as that semicolon make the following line independent of that if statement
die("Changed field");
I haven't checked the code in detail, but the most likely problem is that the server is not set up to send mail.
Check
a) php settings for mail (you can do this by running phpinfo(); but usually these are set up correctly out of the box.
b) Check server mail application is installed and configured, eg Exim, Sendmail, etc.
Setting up a server to send (but not receive) mail is fairly easy. Eg on a Debian server you would run something like
sudo apt-get install exim4
And then follow instructions to configure it to send mail.
A few things to check:
Is your mail server properly configured?
Can you send test email successfully?
Do you have any other control in place to test whether the infrastructure overall works, rather than just the one script that is not currently working?
Also consider using a library such as PHPMailer (http://phpmailer.worxware.com/). It offers much more flexibility when it comes to configuring your mail server.
At your if statement:
if($_POST['trojan'] != '');
die("Changed field");
Should be:
if($_POST['trojan'] != ''){
die("Changed field");
}