Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6859519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:17:36+00:00 2026-05-27T02:17:36+00:00

I have created a large form for my website and I have tried to

  • 0

I have created a large form for my website and I have tried to code the php to pick up the information entered on the form. But when the user submits the only message I get in my email is the message body and the user’s information is not there. This is the code for the form:

<div id="stylized" class="myform">
<form id="myform" name="myform" action="bookingform.php">
<h1></h1>
<p></p>

<div id="firstname">
<label>Name
<span class="small">Add your name</span>
</label>
<input type="text" name="FirstName" id="FirstName"  />
</div>

<div id="email">
<label>Email
<span class="small">Add a valid email address</span>
</label>
<input type="text" name="Email" id="Email" />
</div>

<div id="phone">
<label>Tel Number
<span class="small">Add phone number</span>
</label>
<input type="text" name="Phone" id="Phone" />
</div>


<label>Address
<span class="small">Add your address</span>
</label>
<input type="text" name="Address" id="Address" />


<h2 style="margin-top:140px;">Event Venue Information</h2>

<div id="dates">
<label>Date of Event
<span class="small">Date of your occasion</span>
</label>
<input type="text" name="datex" id="datex" />
</div>
<div>
<label>Occasion
<span class="small">Type of occasion</span>
</label>
<input type="text" name="type" id="type" />
</div>

<div style="margin-left:315px;">
<label>Venue
<span class="small">Location of event</span>
</label>
<input type="text" name="location" id="location" />
</div>
<div style="float:right; margin-right:25px;">
<label>Services Required
<span class="small">Service needed</span>
</label>
<textarea cols="40" rows="5" name="services">
</textarea>
</div>


<div style="margin-top:-20px;">
<label>Please photo's that you find are useful:</label>
<input type="file" name="datafile" size="40"
onchange="return validateFileExtension(this)">
<input type="file" name="datafile" size="40"
onchange="return validateFileExtension(this)">
</div>


<h2 style="margin-top:260px;">Additional Information</h2>

<div style="margin-left:-40px; margin-top:30px;">
<label>How you found us?
<span class="small">Website/DJ's/Friend</span>
</label>
<input type="text" name="found" id="found" />
</div>

<div style="float:right; margin-right:10px;">
<label>Your comments/questions
<span class="small">Any other queries</span>
</label>
<textarea cols="40" rows="5" name="questions">
</textarea>
</div>
<div>
<input class="buttons" style="margin-top:10px; margin-left:110px;" type="submit" 
value="Submit" 
></input>
</div>

<div class="spacer"></div>

</form>
<script language="JavaScript" type="text/javascript"
    xml:space="preserve">//<![CDATA[
//You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("myform");
  frmvalidator.addValidation("FirstName","req","Please enter your First Name");
  frmvalidator.addValidation("FirstName","maxlen=20",   "Max length for FirstName is 20");
  frmvalidator.addValidation("FirstName","alpha","Alphabetic chars only");

  frmvalidator.addValidation("Email","maxlen=50");
  frmvalidator.addValidation("Email","req");
  frmvalidator.addValidation("Email","email");

  frmvalidator.addValidation("Phone","maxlen=50");
  frmvalidator.addValidation("Phone","numeric");

  frmvalidator.addValidation("Address","maxlen=50");

//]]></script>
</div>

This is the php code:

<?php
$boundary = uniqid('np');

$field_name = $_POST['FirstName'];
$field_email = $_POST['Email'];
$field_phone = $_POST['Phone'];
$field_address = $_POST['Address'];
$field_date = $_POST['datex'];
$field_type = $_POST['type'];
$field_location = $_POST['location'];
$field_services = $_POST['services'];
$field_found = $_POST['found'];
$field_comments = $_POST['questions'];

$mail_to = 'user1@hotmail.co.uk';


$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Address: '.$field_address."\n";
$body_message .= 'Date: '.$field_date."\n";
$body_message .= 'Type of Occasion: '.$field_type."\n";
$body_message .= 'Location: '.$field_location."\n";
$body_message .= 'Services required: '.$field_services."\n";
$body_message .= 'How they found us: '.$field_found."\n";
$body_message .= 'Comments - Questions: '.$field_comments;

$headers = "MIME-Version: 1.0\r\n";
$headers = 'From: '.$Email."\r\n";

 $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";


$message = "This is a MIME encoded message."; 

 $message .= "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
 $message .= "This is the text/plain version.";

 $message .= "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
 $message .= "This is the <b>text/html</b> version.";

 $message .= "\r\n\r\n--" . $boundary . "--";



$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
    <script language="javascript" type="text/javascript">
        alert('Thank you for the message. We will contact you shortly.');
        window.location = 'http://www.hrsevents.co.uk';
    </script>
<?php
}
else { ?>
    <script language="javascript" type="text/javascript">
        alert('Message failed. Please, send an email to user1@hotmail.co.uk');
        window.location = 'url';
    </script>
<?php
}
?>

I would be very grateful if someone could help me out with this as I am completely stuck.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:17:37+00:00Added an answer on May 27, 2026 at 2:17 am

    You need to set the form attribute method="post". Without the attribute the form automatically submits as a GET request while your PHP code is trying to get POST data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi im quite new to PHP, i have created a form for very large
I have form created by the admin generator in the backend of a website.
I have created a registration form in silverlight 4, where i have a large
I have created a large Visual C++ 10.0 project which builds nicely within the
I have a PHP script that creates large complex tables. I am attempting to
We have a large internal data collection website. I don't have time to create
Using CakePHP 1.3.6 I'm sure I may have to add code and examples, but
I have a large file, so I have created a filter for removing invalid
I currently have a relatively large HTML form (100+ fields). I want to take
I have an model called Purchase.rb. each purchase is created through a form as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.