Jump to content

how to create 1 page form submission


pixeltrace

Recommended Posts

guys,

 

i need help.

 

how can i combine my formpage and the submit page into just 1 page?

this is the code in my form page

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
margin-top: 0px;
}
-->
</style></head>

<body>
<table width="546" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="546" class="text5">      : Send us your Feedback : </td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td><table width="100" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#9F9F9F" style="border-collapse:collapse">
      <tr>
        <td><form method="post" action="feedbacksend.php">
          <table width="494" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td colspan="2"> </td>
            </tr>
            <tr>
              <td colspan="2" align="center" bgcolor="#e5e5e5" class="text7">Please make sure that correct information is supplied so we can get back to you. </td>
            </tr>
            <tr>
              <td colspan="2"> </td>
            </tr>
            <tr>
              <td width="119" align="right" class="text6">name : </td>
              <td width="369"><input name="name" type="text" class="field3" />
                      <span class="text3">*</span> </td>
            </tr>
            <tr>
              <td align="right" class="text6">email : </td>
              <td><input name="email" type="text" class="field3" />
                      <span class="text3">* </span></td>
            </tr>
            <tr>
              <td align="right" class="text6">contact number  : </td>
              <td><input name="contact" type="text" class="field3" />
                      <span class="text3">* </span></td>
            </tr>
            <tr>
              <td align="right" class="text6">type of inqiuiry : </td>
              <td><select name="inquiry" class="field3">
                <option value="General" selected="selected">--General--</option>
                <option value="Referral/Job Application">--Referral/Job Application--</option>
                <option value="Recruiting/Job Post">--Recruiting/Job Post--</option>
                <option value="Resources">--Resources--</option>
                <option value="Advertisement">--Advertisement--</option>
              </select>              </td>
            </tr>
            <tr>
              <td align="right" class="text6">subject : </td>
              <td><input name="subject" type="text" class="field3" /></td>
            </tr>
            <tr>
              <td align="right" class="text6">your message : </td>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
              <td><textarea name="message" cols="40" rows="5" class="field3"></textarea></td>
            </tr>
            <tr>
              <td> </td>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
              <td><input name="Submit" type="submit" class="button1" value="Submit" />
                      <input type="hidden" name="recipient" value="[email protected]" />
                      <input type="hidden" name="cc" value="[email protected]" />
				  <input type=hidden value=http://www. name=redirect></td>
            </tr>
            <tr>
              <td colspan="2"> </td>
            </tr>
          </table>
        </form></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

 

and this is the code in my feedbacksend.php

<?php
include("validate.php");
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$inquiry = $_POST['inquiry'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$recipient = $_POST['recipient'];
$cc = $_POST['cc'];

if ($name=='' or $email=='' or $contact=='')  { 
         error ('Some required fields are blank.\\n'.
              'Please fill them in and try again.');
    }
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)){ 
  error("Invalid e-mail address");
  }
$Message = "";
$Message .= "A Feedback Inquiry from: $name\n";
$Message .= "Contact Number: $contact\n";
$Message .= "Email Address: $email\n";
$ip = getenv("REMOTE_ADDR");
$Message .="IP address:".$ip."\n";
$Message .= "\n\n";
$Message .= "Type of Inquiry: $inquiry\n";
$Message .= "Subject: $subject\n";
$Message .= "\n\n";
$Message .= "Message: $message\n";
$Message .= "\n\n";

$Header = $email;
$To = "$recipient, $cc";
$Subject = "JH Feedback Inquiry"; 

// mail($To,$Subject,$Message,"From: $Header","-f $EmailAdd"); last parameter might not be supported
mail($To,$Subject,$Message,"From: $Header");

echo '<script language=javascript> alert("Your message has been sent!");top.location = "contactus.php?id=3";</script>';

?>

 

hope you could help me on this.

thanks!

Link to comment
https://forums.phpfreaks.com/topic/48396-how-to-create-1-page-form-submission/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.