I wrote HTML and PHP that sends an email using a form, but the code is not working. I am getting an error message on submit, "This page isn’t working
CodePudding user response:
Try this
<div style="padding:20px" >
<h2>Become a Volunteer</h2>
<br>
<form id="fcf-form-id" method="post" action="volunteer.php">
<div >
<div >
<label for="Position">Volunteer Position </label><span>:</span></div>
<div >
<input type="text" id="Position" placeholder="Tell us what you are volunteering for" name="Position" required>
</div>
</div>
<div >
<div >
<label for="Name">Full Name </label><span>:</span></div>
<div >
<input type="text" id="Name" placeholder="Enter Name" name="Name" pattern=[A-Z\sa-z]{4,30} required>
</div>
</div>
<div >
<div >
<label for="Email">Email Address </label><span>:</span></div>
<div >
<input type="email" id="Email" name="Email" placeholder="Enter Email Address" required>
</div>
</div>
<div >
<div >
<label for="Number">Mobile Number</label><span>:</span></div>
<div >
<input type="tel" id="Number" name="Number" placeholder="Enter Mobile Number" required>
</div>
</div>
<div >
<div >
<label for="Address">Address </label><span>:</span></div>
<div >
<input type="text" id="Address" placeholder="Your residential address" name="Address" required>
</div>
</div>
<div >
<div >
<label for="State">Enter State </label><span>:</span></div>
<div >
<input type="text" id="State" name="State" placeholder="Your State of Residence" required>
</div>
</div>
<div >
<div >
<label for="Country">Enter Country</label><span>:</span></div>
<div >
<input type="text" id="Country" name="Country" placeholder="Your Country of Residence" required>
</div>
</div>
<div >
<div >
<label for="Occupation">Occupation </label><span>:</span></div>
<div >
<input type="text" id="Occupation" placeholder="Enter Occupation" name="Occupation" required>
</div>
</div>
<div >
<div >
<label for="Experience">Volunteer Xpernce.</label><span>:</span></div>
<div >
<input type="text" id="Experience" name="Experience" placeholder="Your previous volunteer experience / Optional " >
</div>
</div>
<div >
<div >
<label for="Languages">Languages Spoken</label><span>:</span></div>
<div >
<input type="text" id="Languages" name="Languages" placeholder="Tell us the language(s) you speak fluently" required>
</div>
</div>
<div >
<div >
<label for="Gender">Gender</label><span>:</span></div>
<div >
<select id="Gender" name="Gender" required>
<option Value="">Select your Gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<div >
<div >
<label for="Dob">Date of Birth</label><span>:</span></div>
<div >
<input type="date" id="Dob" name="Dob" placeholder="Enter your Date of Birth" required>
</div>
</div>
<div >
<div >
<label for="Info">Other information</label><span>:</span></div>
<div >
<textarea rows="5" id="Info" placeholder="Enter other information that enable us make a good match" ></textarea>
</div>
</div>
<div style="margin-top:10px;" >
<div style="padding-top:10px;" >
<label></label>
</div>
<div >
<button type="submit" id="fcf-button" >Submit</button>
</div>
</div>
</form>
</div>
and create php file volunteer.php
<?php var_dump($_POST) ?>
You will see all posts inside var_dump