upload file on three drop down selected values using php - php

I want to upload file on specific of selection from three dropdown menus.
For example:
if course (vfx), faculty (john), assignment (1) selected then on submit file should be uploaded to specific folder or location.
Thank You.
<form action="" method="post" enctype="multipart/form-data">
<table width="1561" height="1441" border="0" align="center">
<tr>
<td height="505" align="center" valign="middle">
<table width="500" border="0" align="center">
<tbody>
<tr>
<td height="42" align="left"> </td>
<td colspan="2" align="left" valign="middle"><img src="download.jfif" width="167" height="151" alt="" /></td>
</tr>
<tr>
<td height="42" align="left">Course</td>
<td align="left" valign="middle">:</td>
<td align="left" valign="middle">
<select name="Course" size="0" required="required" id="Course">
<option disabled selected>Select</option>
<option value="animation">Animation</option>
<option value="vfx">Vfx</option>
<option value="graphic">Graphic Design</option>
<option value="first">F.y. Bsc</option>
<option value="second">S.y.Bsc</option>
<option value="third">T.y.Bsc</option>
</select>
</td>
</tr>
<tr>
<td width="128" height="31" align="left">Assignment No.</td>
<td width="27" align="left" valign="middle">:</td>
<td width="331" align="left" valign="middle">
<select name="assignment" size="0" required id="assignment">
<option disabled selected>Select</option>
<option value="one">Assignment 1</option>
<option value="two">Assignment 2</option>
<option value="three">Assignment 3</option>
<option value="four">Assignment 4</option>
<option value="five">Assignment 5</option>
<option value="six">Assignment 6</option>
<option value="seven">Assignment 7</option>
<option value="eight">Assignment 8</option>
<option value="nine">Assignment 9</option>
<option value="ten">Assignment 10</option>
</select>
</td>
</tr>
<tr>
<td height="38" align="left">Faculty</td>
<td align="left" valign="middle">:</td>
<td align="left" valign="middle">
<select name="Faculty" size="0" required id="Faculty">
<option disabled selected>Select</option>
<option value="john">john</option>
<option value="andrew">andrew</option>
<option value="juli">juli</option>
<option value="parkar">parkar</option>
<option value="other">Other</option>
</select>
</td>
</tr>

First of all you have to create the form element around your form, if you have already created then I am considering its method to be POST and considering the button name is btn and the code for your problem is as follows :
<?php
//Enter your code here, enjoy!
if(isset($_POST['btn']) )
{
// getting the values from the form
$courseValue = $_POST['Course'];
$assignment = $_POST['assignment'];
$faculty = $_POST['Faculty'];
// condition to check for file uploading
if($courseValue =="vfx" && $assignment == "1" && $faculty == "john")
{
// code to upload file or some other actions
}
}

Related

How to retrieve the selected value from dropdown and display it in the same dropdown box

I have three dropdown boxes. Namely DS, QA, Mod. First step is DS will select a value (YES/NO) & upon submitting, QA will be reviewing the input of DS. I have to get the values of DS Dropdown and display it in the same dropdown box of DS(disabled) when QA is about to check the input.Same goes with Mod.Take note that these dropdown boxes exists in checklist.php file.
<table width="100%" border="1">
<tbody>
<tr>
<td align="left" rowspan="2"><b>Check Items</b></th>
<td><b>DS</b></td>
<td><b>QA</b></td>
<td><b>Mod?</b></td>
</tr>
<tr>
<td align="center" rowspan="2"><select id="valueDS1">
<option value="YD1">YES</option>
<option value ="NAD1">N/A</option>
</select>
</td>
<td align="center" rowspan="2"><select id="valueQA1">
<option value="YQ2">YES</option>
<option value ="NAQ2">N/A</option>
</select>
</td>
<td align="center" rowspan="2"><select id="valueMod1">
<option value="YM1">YES</option>
<option value ="NM1">NO</option>
</select>
</td>
</tr>
<tr>
<td> All extra instructions and corrections applied.</td>
<tr>
<td>
<p> If comments exist, ask DE if they need to be deleted or retained (but hidden)</p>
</td>
<td align="center"><select id="valueDS2">
<option value="Y">YES</option>
<option value ="NA">N/A</option>
</select>
</td>
<td align="center"><select id="valueQA2">
<option value="Y">YES</option>
<option value ="NA">N/A</option>
</select>
</td>
<td align="center"><select id="valueMod2">
<option value="Y">YES</option>
<option value ="NA">NO</option>
</select>
</td>
</tr>
</table>
Inside the PHP code, assign a variable to the dropdown.
$DS= $_POST['DS']
Now, in the HTML of the dropdown do something like following
<select>
<option <?php if(isset($DS) && $DS=="yes" ){ echo "selected"; } ?> value="yes" disabled>Yes</option>
</select>

select option selected in loop

I am trying to get the value from a selectbox. The form is placed multiple times on my page with a php loop (that's why I use classes instead of id's).
<html>
<body>
<table>
<form class="lesmaker">
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info">Informatie</option>
<option value="discussie">Klassikaal</option>
<option value="meerkeuze" selected="selected">Meerkeuze</option>
</select>
</td>
</tr>
<tr>
<td colspan="5">
<select name="media" class="media">
<?php foreach($images as $image){if(substr($image,0,1) != '.'){ ?>
<option style="background-image:url(<?=$d_images.$image?>)" value="<?=$image?>" <?php if($r_media== $image) echo 'selected="selected"'; ?>><?=$image?></option>
<?php }} ?>
</select>
</td>
</tr>
</form>
</table>
<table>
<form class="lesmaker">
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info">Informatie</option>
<option value="discussie">Klassikaal</option>
<option value="meerkeuze" selected="selected">Meerkeuze</option>
</select>
</td>
</tr>
<tr>
<td colspan="5">
<select name="media" class="media">
<?php foreach($images as $image){if(substr($image,0,1) != '.'){ ?>
<option style="background-image:url(<?=$d_images.$image?>)" value="<?=$image?>" <?php if($r_media== $image) echo 'selected="selected"'; ?>><?=$image?></option>
<?php }} ?>
</select>
</td>
</tr>
</form>
</table>
</body>
</html>
With jQuery I am trying to get the selected option.
$(function(){
$('.lesmaker').each(function() {
console.log($(this).find('.type').val());
});
});
The code above is not working. How do I need to do this?
$(function() {
$('.lesmaker').each(function() {
console.log($(this).find('table tr td').find('.type').val());
});
});
You need to change your HTML to following:
<form class="lesmaker">
<table>
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info">Informatie</option>
<option value="discussie">Klassikaal</option>
<option value="meerkeuze" selected="selected">Meerkeuze</option>
</select>
</td>
</tr>
</table>
</form>
form needs to be either outside of table or inside of td :)
$(function() {
$('.type').each(function() {
console.log($('option:selected', this).val());
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table>
<form class="lesmaker">
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info">Informatie</option>
<option value="discussie">Klassikaal</option>
<option value="meerkeuze" selected="selected">Meerkeuze</option>
</select>
</td>
</tr>
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info">Informatie</option>
<option value="discussie" selected="selected">Klassikaal</option>
<option value="meerkeuze" >Meerkeuze</option>
</select>
</td>
</tr>
<tr>
<td colspan="5">
<select name="type" class="type">
<option value="open">Open vraag</option>
<option value="info" selected="selected">Informatie</option>
<option value="discussie" >Klassikaal</option>
<option value="meerkeuze" >Meerkeuze</option>
</select>
</td>
</tr>
</form>
</table>
Just use the class of select and use $('option:selected', this).val()

Value from drop down list html

Trying to pass the value from Drop down list through but couldnt get it.
<tr>
<td>Size <br>
(Only applicable for T-Shirt):</td>
<td><select name=size>
<option value=N>NIL</option>
<option value=S>S</option>
<option value=M>M</option>
<option value=L>L</option>
<option value=XL>XL</option>
</select></td>
</tr>
<tr>
<td></td>
<td><a href= manageProduct.php?size=$_GET[size]>Insert</a></td>
</tr>
Give this a try: (just an example).
<form action="<?php $_SERVER['PHP_SELF']?>" method="GET">
<table>
<tr>
<td nowrap>Size:
(Only applicable for T-Shirt):</td>
<td><select name="size">
<option value="N">NIL</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
</select></td>
</tr>
<tr>
<td><p align="right"></p></td>
<td><input type="submit" value="Insert" />
</td>
</tr>
</table>
</form>
<?php
$size = $_GET['size'];
if($_GET['size']=="N")
{
echo "you chose NOTHING, make another choice.";
}
else {
echo "Your choice of size is: $size";
}
?>
Html
<form action="manageProduct.php" method="POST">
<table>
<tr>
<td>Size <br>
(Only applicable for T-Shirt):</td>
<td><select name=size>
<option value=N>NIL</option>
<option value=S>S</option>
<option value=M>M</option>
<option value=L>L</option>
<option value=XL>XL</option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Insert" /></td>
</tr>
</table>
</form>
PHP
$size = $_POST['size'];
You need a form using the GET action then you can get your variable.
Assuming this page is the manageProduct.php:
<!--GET your data from the submitted form OR do something depending on what size returns in the url-->
<?php
if($_GET['size']=="SIZE"){ echo whatever or do whatever}
?>
<td>Whatever you're trying to do</td>
<form id="form" method="get" action="manageProduct.php">
<tr>
<td>Size <br>
(Only applicable for T-Shirt):</td>
<td><select name="size">
<option value="N">NIL</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Insert" /></td>
<br />
</form>
</tr>

website moved and php form not working (old php version)

I moved website from to other hosting server and contact form doesn't work. Current version of php is 5.2 and before was older. I saw on forums that in order for older php code to work i should turn globals on which I did (I know it's insecure and I will replace that code completely, but right now I have to make it work). Before I turned globals on nothing was working and now I'm getting message if some field is missing but nothing more than that. Any suggestions how to make this contact form work? Any answer will be very appreciated.
<?
$contact = 'contact';
require('inc_meta.php');
if($form)
{
$error = Array();
if(!trim($c_name)){ $error[sizeof($error)] = "Name"; }
if(!trim($email)){ $error[sizeof($error)] = "E-mail Address"; }
else {
if(!eregi("^[_\.0-9a-z-]+#([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email)){ $error[sizeof($error)] = "'" . $email . "' is not avalid E-mail Address."; }
}
}
$filePath = getenv("SCRIPT_NAME");
if($_SERVER['HTTP_REFERER'] == 'http://'.$_SERVER['SERVER_NAME'].''.$filePath.'')
{
if($form && !$error)
{
$contents = "Name: $c_name\r
Address:\r
$c_address\r
$c_city, $c_state $c_zip\n
Phone: $c_phone\r
Fax: $c_fax\r
Email: $email\n
Comments or Questions:\r
$c_comments";
mail("$EMAILADMIN","email from $c_name","$contents","From: $c_name<$email>");
$status = "Thank You, <b>$c_name</b><br><br>";
$status .= "Your e-mail message has been sent. We will contact you shortly about your inquiry. ";
$status .= "If you need more assistance or have questions, please call us at <b>1234567</b><br><br>";
$status .= "Thank You,<br><b>Owner</b><br>";
}}
?>
<table width="860" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="325">
<? include('inc_sideBar.php'); ?>
</td>
<td width="535">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<? include('inc_header.php'); ?>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td align="center" valign="top">
<? if(!$status){ ?>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<form name="form" method="post" action="<? echo $PHP_SELF; ?>">
<td>
<? if(sizeof($error)){ ?>
<font color="#FADE82"><b> The following fields are still
required:<br>
<?
for($i = 0; $i < sizeof($error); $i++) {
echo " *", " ", $error[$i];
}
?>
</b></font><br>
<br>
<? } ?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="54%" valign="top"><font color="#FFF9DD">Name</font><font color="#CC0000">
<font color="#FADE82"></font></font><b><font color="#CC0000"><font color="#FADE82">*</font><br>
<input type="text" name="c_name" value="<? echo $c_name; ?>" size="23">
</font></b></td>
<td width="46%" valign="top"><font color="#FFF9DD">State</font><b><br>
</b>
<select name="c_state">
<option>
<? echo $c_state; ?>
</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="DC">Washington, D.C.</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</td>
</tr>
<tr>
<td valign="top" width="54%"><font color="#FFF9DD">E-mail</font><font color="#CC0000">
<font color="#FADE82"></font></font><b><font color="#CC0000"><font color="#FADE82">*</font>
<br>
<input type="text" name="email" value="<? echo $email; ?>" size="23">
</font></b></td>
<td valign="top" width="46%"><font color="#FFF9DD">Zip</font><b><br>
</b>
<input type="text" name="c_zip" value="<? echo $c_zip; ?>" size="20">
</td>
</tr>
<tr>
<td valign="top" width="54%"><font color="#FFF9DD">Address</font><b><br>
<input type="text" name="c_address" value="<? echo $c_address; ?>" size="23">
</b></td>
<td valign="top" width="46%"><font color="#FFF9DD">Phone</font><b><br>
</b>
<input type="text" name="c_phone" value="<? echo $c_phone; ?>" size="20">
</td>
</tr>
<tr>
<td valign="top" width="54%"><font color="#FFF9DD">City</font><b><br>
<input type="text" name="c_city" value="<? echo $c_city; ?>" size="23">
</b></td>
<td valign="top" width="46%"><font color="#FFF9DD">Fax</font><b><br>
</b>
<input type="text" name="c_fax" value="<? echo $c_fax; ?>" size="20">
</td>
</tr>
<tr>
<td valign="top" width="54%"> </td>
<td valign="top" width="46%"> </td>
</tr>
<tr>
<td valign="top" colspan="2"> <font color="#FFF9DD">Comments
or Questions?:</font><br>
<textarea name="c_comments" wrap="VIRTUAL" cols="30" rows="5"><? echo $c_comments; ?></textarea>
<br>
<br>
</td>
</tr>
<tr>
<td valign="top" colspan="2">
<input type="image" border="0" name="imageField" src="images/submit.gif" class="select">
</td>
</tr>
</table>
<input type="hidden" name="form" value="one">
</td>
</form>
</tr>
</table>
<? }else{ ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<font color="#FFF9DD"><? echo $status; ?></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
</table>
<br>
<? include('footer_info.php'); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<? require('inc_footer.php'); ?>
You should access the form data using the $_POST array.
Read the Warning in this page of the php docs: http://www.php.net/manual/en/language.variables.predefined.php

Problem with Http redirect using HTML meta tags

please see the following code
// redirect to success page
if ($success){
header( 'Location: ../Scripts/_lib/phpmailer-fe.php');
}
else{
print "<meta http-equiv="refresh" content="0;URL=error.html">";
}
its not working
<form method="post" action="" enctype="multipart/form-data" name="quest">
<input type="hidden" value="valvedevelopertool.html" name="referer">
<table cellspacing="0" cellpadding="0"width="650" align="center">
<tr class="tablerow">
<td id="apptitlebox" colspan="2"><span class="valvedevelopertitle">Valve Specification Developer Tool</span></td></tr>
</table>
<br /><br />
<p align="center">Please enter known details to help assist us in processing your enquiry accuratly and quickly.</p>
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr>
<td class="valvedevelopertoolreftitle">Reference</td><td><input type="text" style="width:204px" class="border" name="vdt_ref"/></td><td class="valvedevelopertoolreftitle">Date</td><td><input type="text" style="width:204px" class="border" name="vdt_date"/></td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr><td class="valvedevelopertoolreftitle">Enquiry 1</td></tr>
<tr class="tablerow">
<td width="154" class="titlebg"></td><td width="243" class="valvedevelopertooltexttitle titlebg">Select Known Specifications</td><td width="99" class="valvedevelopertooltexttitle titlebg"></td>
<td width="252" class="valvedevelopertooltexttitle titlebg">Add More Detail</td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Qty</td>
<td class="valvedevelopertooltext">
<select name="vdt_qty" id="Type" class="border" style="width:204px" onchange="qty1(document.quest.vdt_qty.value); qty2(document.quest.vdt_qty.value)">
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="otherqty">Other (specify to the right)</option>
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="otherqtytitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="otherqty" class="border"></span>
</td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft highlight1">Type</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_type" id="vdt_type" class="border" style="width:204px" onchange="type1(document.quest.vdt_type.value); type2(document.quest.vdt_type.value)">
<option selected value="">Please Select</option>
<option value="PSV">PSV (Pressure Safety/Relief Valve)</option>
<option value="Controll Valve">Control Valve</option>
<option value="Ball Valve">Ball Valve</option>
<option value="Wedge Gate Valve">Wedge Gate Valve</option>
<option value="Parallel Slide Gate Valve">Parallel Slide Gate Valve</option>
<option value="Through Conduit Gate Valve">Through Conduit Gate Valve</option>
<option value="Knife Gate Valve">Knife Gate Valve</option>
<option value="Globe Valve">Globe Valve</option>
<option value="checkvalve">Check Valve</option>
<option value="Plug Valve">Plug Valve</option>
<option value="Choke Valve">Choke Valve</option>
<option value="Butterfly Valve">Butterfly Valve</option>
<option value="Needle Valve">Needle Valve</option>
<option value="Double Block/Bleed Valve">Double Block / Bleed Valve</option>
<option value="3 Way Valve">3 Way Valve</option>
<option value="4 Way Valve">4 Way Valve</option>
</select></td>
<td class="valvedevelopertoolextratext highlight1"><span id="checkvalvetypetitle" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="checkvalvetype" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Size</td>
<td class="valvedevelopertooltext">
<select name="vdt_size" id="Type" class="border" style="width:204px" onchange="size1(document.quest.vdt_size.value); size2(document.quest.vdt_size.value)">
<option selected value="">Please Select</option>
<option value="0.5">0.5"</option>
<option value="1">1"</option>
<option value="1.5">1.5"</option>
<option value="2">2"</option>
<option value="4">4"</option>
<option value="6">6"</option>
<option value="8">8"</option>
<option value="10">10"</option>
<option value="12">12"</option>
<option value="14">14"</option>
<option value="16">16"</option>
<option value="18">18"</option>
<option value="20">20"</option>
<option value="24">24"</option>
<option value="30">30"</option>
<option value="36">36"</option>
<option value="40">40"</option>
<option value="othersize">Other (specify to the right)</option>
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="othersizetitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="othersize" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft highlight1">Pressure Class</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_class" onchange="class1(document.quest.vdt_class.value); class2(document.quest.vdt_class.value)" class="border" style="width:204px">
<option value="">Please Select</option>
<option value="ANSI">ANSI</option>
<option value="PN">PN</option>
<option value="API">API</option>
</select>
</td>
<td class="valvedevelopertoolextratext highlight1" align="right"><span id="classname" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="classtypes" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">End Connections</td>
<td class="valvedevelopertooltext">
<select name="vdt_end" id="Type" class="border" style="width:204px">
<option selected value="">Please Select</option>
<option value="Flanged Raised Face">Flanged Raised Face</option>
<option value="Flanged Flat Face">Flanged Flat Face</option>
<option value="Flanged Ring Type Joint">Flanged Ring Type Joint</option>
<option value="Socket Weld Female">Socket Weld Female</option>
<option value="Socket Weld Male">Socket Weld Male</option>
<option value="Screwed Female">Screwed Female</option>
<option value="Screwed Male">Screwed Male</option>
</select>
</td>
<td class="valvedevelopertooltext"> </td>
<td class="valvedevelopertooltext"> </td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft highlight1">Bore</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_bore" id="Type" class="border" style="width:204px">
<option selected value="">Please Select</option>
<option value="Full">Full</option>
<option value="Reduced">Reduced</option>
</select>
</td>
<td class="valvedevelopertooltext highlight1"> </td>
<td class="valvedevelopertooltext highlight1"> </td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Body Material</td>
<td class="valvedevelopertooltext">
<select name="vdt_body" id="Type" class="border" style="width:204px" onchange="body1(document.quest.vdt_body.value); body2(document.quest.vdt_body.value)">
<option selected value="">Please Select</option>
<option value="Carbon Steel">Carbon Steel</option>
<option value="Stainless Steel">Stainless Steel</option>
<option value="Duplex">Duplex</option>
<option value="Alloy">Alloy</option>
<option value="Bronzes">Bronzes</option>
<option value="Leaded Gunmetal">Leaded Gunmetal</option>
<option value="Low Temp Nickel Alloy Steel">Low Temp Nickel Alloy Steel</option>
<option value="Titanium">Titanium</option>
<option value="Hastelloy">Hastelloy</option>
<option value="Monel">Monel</option>
<option value="Cast Iron">Cast Iron</option>
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="bodytitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="bodytypes" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft highlight1">Trim Material</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_trim" id="Type" class="border" style="width:204px" onchange="trim1(document.quest.vdt_trim.value); trim2(document.quest.vdt_trim.value)">
<option selected value="">Please Select</option>
<option value="Carbon Steel">Carbon Steel</option>
<option value="Stainless Steel">Stainless Steel</option>
<option value="Duplex">Duplex</option>
<option value="Alloy">Alloy</option>
<option value="13% Chrome Steel">13% Chrome Steel</option>
<option value="Bronze and Aluminium Bronze">Bronze & Aluminium Bronze</option>
<option value="Nickel Aluminium Bronze">Nickel Aluminium Bronze</option>
<option value="Leaded Gunmetal">Leaded Gunmetal</option>
<option value="Titanium">Titanium</option>
<option value="Low Temp Nickel Alloy Steel">Low Temp Nickel Alloy Steel</option>
<option value="Monel">Monel</option>
<option value="Cast Iron">Cast Iron</option>
<option value="Ceramics">Ceramics</option>
</select>
</td>
<td class="valvedevelopertoolextratext highlight1"><span id="trimtitle" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="trimtypes" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Seat Material</td>
<td class="valvedevelopertooltext">
<select name="vdt_seat" id="Type" class="border" style="width:204px" onchange="seat1(document.quest.vdt_seat.value); seat2(document.quest.vdt_seat.value)">
<option selected value="">Please Select</option>
<option value="PTFE">PTFE</option>
<option value="Nylon">Nylon</option>
<option value="Peek">Peek</option>
<option value="Viton">Viton</option>
<option value="Metal">Metal</option>
</select>
</td>
<td class="valvedevelopertoolextratext" align="right"><span id="seatgradetitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="seatgrade" class="border"></span></td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft highlight1">NACE Materials</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_nace" id="Type" class="border" style="width:204px">
<option selected value="">Please Select</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</td>
<td class="valvedevelopertooltext highlight1"> </td>
<td class="valvedevelopertooltext highlight1"> </td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Operation</td>
<td class="valvedevelopertooltext">
<select name="vdt_operation" id="Type" class="border" style="width:204px" onchange="operation1(document.quest.vdt_operation.value); operation2(document.quest.vdt_operation.value)">
<option selected value="">Please Select</option>
<option value="Manual Hand Lever">Manual Hand Lever</option>
<option value="Manual Handwheel">Manual Handwheel</option>
<option value="Manual Gearbox">Manual Gearbox</option>
<option value="Automated/Actuated">Automated / Actuated</option>
<option value="otheroperation">Other (specify to the right)</option>
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="otheroperationtitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="otheroperation" class="border"></span>
</td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1">Other Information</td>
<td class="valvedevelopertooltextarea highlight1" colspan="3" align="left" style="padding-left:23px; padding-top:3px; height:95px"><span class="valvedevelopertooltextarea highlight1" style="padding-top:3px; height:95px">
<textarea name="textarea" cols="5" rows="4" class="border" style="width:550px"></textarea>
</span></td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr class="tablerow">
<td width="154" class="titlebg"></td><td width="243" class="valvedevelopertooltexttitle titlebg">Your Details</td><td width="99" class="valvedevelopertooltexttitle titlebg"></td>
<td width="252" class="valvedevelopertooltexttitle titlebg"></td>
</tr>
<tr>
<td class="valvedevelopertoolleft" width="154">Name</td>
<td class="valvedevelopertooltext" width="243"><input name="contact_name" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext" width="99"> </td>
<td class="valvedevelopertooltext" width="252"> </td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1" width="154">Email Address</td>
<td class="valvedevelopertooltext highlight1" width="243"><input name="contact_email" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext highlight1" width="99"> </td>
<td class="valvedevelopertooltext highlight1" width="252"> </td>
</tr>
<tr>
<td class="valvedevelopertoolleft" width="154">Telephone Number</td>
<td class="valvedevelopertooltext" width="243"><input name="contact_tel" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext" width="99"> </td>
<td class="valvedevelopertooltext" width="252"> </td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1" width="154">Company</td>
<td class="valvedevelopertooltext highlight1" width="243"><input name="contact_company" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext highlight1" width="99"> </td>
<td class="valvedevelopertooltext highlight1" width="252"> </td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr>
<td colspan="4">
<?php
# Get the reCAPTCHA library
require_once('../recaptcha/recaptchalib.php');
# These are /not/ real keys - you must replace them with your *own* keys
# obtained from http://recaptcha.net/api/getkey
define('PUBLIC_KEY', '[MY PUBLIC KEY]');
define('PRIVATE_KEY', '[MY PRIVATE KEY]');
# Did the user fail the captcha test?
$error = null;
# This is where we process the user's response. We don't
# do this when the form is initially displayed - only
# when the user submits it.
if ($_POST["recaptcha_response_field"]) {
$response = recaptcha_check_answer(
PRIVATE_KEY, $_SERVER['REMOTE_ADDR'],
$_POST['recaptcha_challenge_field'],
$_POST['recaptcha_response_field']
);
if ( $response->is_valid ) {
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['vdt_type']));
$EmailTo = "MAIL#MAIL.COM";
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print '<meta http-equiv="refresh" content="0;URL=error.html">';
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "n";
$Body .= "n";
$Body .= "Email: ";
$Body .= $EmailFrom;
$Body .= "n";
$Body .= "n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "n";
$Body .= "n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "n";
$Body .= "n";
$Body .= "Fax: ";
$Body .= $Fax;
$Body .= "n";
$Body .= "n";
$Body .= "Location: ";
$Body .= $Location;
$Body .= "n";
$Body .= "n";
$Body .= "How Did You Hear About Us: ";
$Body .= $HowDidYouHearAboutUs;
$Body .= "n";
$Body .= "n";
$Body .= "Enquiry Type: ";
$Body .= $EnquiryType;
$Body .= "n";
$Body .= "n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "n";
$Body .= "n";
$Body .= "Join Mailing List: ";
$Body .= $MailingList;
$Body .= "n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: noreply#score-training.com");
// redirect to success page
if ($success){
if (isset($_POST['submit'])) {
header ("Location: ../Scripts/_lib/phpmailer-fe.php");
}
else{
print '<meta http-equiv="refresh" content="0;URL=error.html">';
}
}
# For example
# ... validate user input ...
# ... store form data in a database ...
# ... redirect to 'thank you' page
}
else {
# The user failed the reCAPTCHA test so we need
# to fill in the error message and re-try the
# form submission
$error = $response->error;
}
}
# Display the reCAPTCHA challenge. The first time
# through $error will be null.
echo recaptcha_get_html( PUBLIC_KEY, $error );
?>
</td></tr>
<tr>
<td colspan="4" align="center"><input type="submit" value="Submit Enquiry" class="border" name="submit"> <input type="reset" value="Clear Form" class="border"></td>
</tr>
</table>
</form>
You are quoting your string in a wrong way. Encapsulate it in single quotes:
print '<meta http-equiv="refresh" content="0;URL=error.html">';
You should be able to find such errors with any editor that provides decent syntax highlighting (it can even be seen with the syntax highlighter in your question).
I don't know whether this solves the problem, you don't give enough information.
Also note that according to Wikipedia, this method of refreshing is deprecated.
If you are using HTTP 1.1, the URL provided to Location must be absolute:
Note: HTTP/1.1 requires an absolute URI as argument to ยป Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself.

Categories