我很抱歉提出这个问题。我仍然是一个相对较新的网站建设者,形式一直是我的痛苦。我已经搜索并尝试了其他人发布的类似问题的一些想法,这种形式还没有奏效。我在以前的网站上使用它,它工作得非常好。我复制了确切的代码并添加了一些复选框,粘贴到我的新网站中。现在,当我点击提交按钮时,它就会坐下并旋转。
对我的代码的任何建议或编辑将不胜感激。
<form action="process.php" method="post" id="contact_form" name="contact_form">
<div class="name">
<label for="name">Your Name:</label>
<p> Please enter your full name</p>
<input id=name name=name type=text placeholder="e.g. John Smith" required />
</div>
<div class="email">
<label for="email">Your Email:</label>
<p> Please enter your email address</p>
<input id=email name=email type=email placeholder="example@domain.com" required />
</div>
<div class="email">
<label for="phone">Your phone number:</label>
<p> Please enter your phone number</p>
<input id=phone name=phone type=phone placeholder="555-555-5555" required />
</div>
<div class="company">
<label for="company">Your Company:</label>
<p> Please enter your company name</p>
<input id=company name=company type=company placeholder="Your Company Name" required />
</div>
<div class="companyweb">
<label for="companyweb">Your Company Website:</label>
<p> Please enter your company website</p>
<input id=companyweb name=companyweb type=companyweb placeholder="Your Company Website" required />
</div>
<div class="checkbox">
<label for="checkbox">How can we serve you?</label>
<p> Please check all that apply</p>
<p> Consulting:</p>
<p><input id=checkbox name=checkbox[] type="checkbox" value="- Consulting: Operations Improvements" />Operations Improvements<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Consulting: Process Improvements" />Process Improvements<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Consulting: Order Fulfillment" />Order Fulfillment<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Consulting: Technology Analysis & Selection" />Technology Analysis & Selection<br>
<p>Design & Engineering:</p>
<p><input id=checkbox name=checkbox[] type="checkbox" value="- Design & Engineering: New Facility" />New Facility<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Design & Engineering: Retro-fit" />Retro-fit<br>
<p>Technology:</p>
<p><input id=checkbox name=checkbox[] type="checkbox" value="- Technology: Order Fulfillment" />Order Fulfillment<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Technology: ERP Integration" />ERP Integration<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Technology: Incentive Payroll Solution" />Incentive Payroll Solution<br>
<p>Equipment:</p>
<p><input id=checkbox name=checkbox[] type="checkbox" value="- Equipment: Automated Pack/Ship" />Automated Pack/Ship<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Equipment: Vertical & Horizontal Storage Solutions" />Vertical & Horizontal Storage Solutions<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Equipment: Material Handling Systems" />Material Handling Systems<br>
<input id=checkbox name=checkbox[] type="checkbox" value="- Equipment: Carts/Carton Flow/Work Stations" />Carts/Carton Flow/Work Stations<br>
<p></p>
<p><input id=checkbox name=checkbox[] type="checkbox" value="- Other." />Other<br>
<input id="othertext" name="othertext" type="text" class="text required" / >
</p>
<br>
<br>
</p>
</div>
<div id="loader">
<input type="submit" value="Submit" />
</div>
<?php
$emailSubject = 'Contact Us Form';
$name = $_POST ['name'];
$email = $_POST ['email'];
$phone = $_POST ['phone'];
$company = $_POST ['company'];
$companyweb = $_POST ['companyweb'];
$checkbox = implode(' ', $_POST['checkbox']);
$othertext = $_POST ['othertext'];
$body = <<<EOD
Name: $name
Email: $email
Phone: $phone
Company: $company
Company Website: $companyweb
How Can We Serve You: $checkbox
Message: $othertext
EOD;
mail( "myemail@email.com", "Talk to Us",
$body, "From: $email" );
if(!isset($_POST['submit']))
{
echo "Your email was sent successfully.";
} else {
echo 'There was a problem sending your email.';
}
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>