PHP Form CSS & Positioning - php

Thank you for taking the time to read/answer this.
First thing: my career page has a pre-made contact form that i turned into a job application. I have two layout questions:
1.) How do i get the 'checkbox' buttons to line up a little closer to each other. I tried td colspan="2" which is the case later in the form for 2 buttons (submit/reset 1 which i removed), but to no avail, "No" appears well to the right of "Yes." I'd like to have it relatively closer to "Yes."
2.) When you pull the drop down for "Experience" down, it forces the image below the form. Once you select your option, the image goes back to its place. Do i absolutely have to absolute position the graphic? Or can i add an overflow maybe to the dropdown? I can't figure it out.
FancyForm is the form i'm using.
Here is the HTML:
<form id="contact-form" name="contact-form" method="post" action="submit.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="15%"><label for="name">Name</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="address">Address</label></td>
<td width="70%"><input type="text" class="validate[required,custom[a-zA-Z\d\s\-\,\#\.\+]+]" name="address" id="address" value="<?=$_SESSION['post']['address']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="telephone">Telephone</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyNumber]]" name="telephone" id="telephone" value="<?=$_SESSION['post']['telephone']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="email">Email</label></td>
<td width="70%"><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="citizenship">US Citizen</label></td>
<td width="35%"><input type="checkbox" name="citizen" value="yes">Yes</td>
<td width="35%"><input type="checkbox" name="citizen" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="age">At Least 18</label></td>
<td width="35%"><input type="checkbox" name="age" value="yes">Yes</td>
<td width="35%"><input type="checkbox" name="age" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="previousexp">Have you worked<br> with us before?</label></td>
<td width="35%"><input type="checkbox" name="previousexp" value="yes">Yes
<td width="35%"><input type="checkbox" name="previousexp" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="subject">Experience</label></td>
<td width="70%"><select name="subject" id="subject">
<option value="" selected="selected"> - Choose -</option>
<option value="0-5">0-5 Years</option>
<option value="6-10">6-10 Years</option>
<option value="11-15">11-15 Years</option>
<option value="16-20">16-20 Years</option>
</select></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
<td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
<?=$str?> <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td>
</tr>
</table>
</form>
CSS:
#form-container{
padding:0px;
}
td{
white-space:nowrap;
}
h1{
color:#777777;
font-size:22px;
font-weight:normal;
text-transform:uppercase;
margin-bottom:5px;
}
h2{
font-weight:normal;
font-size:10px;
text-transform:uppercase;
color:#aaaaaa;
margin-bottom:15px;
border-bottom:1px solid #484848;
margin-bottom:15px;
}
label{
text-transform:uppercase;
font-size:10px;
font-family:Tahoma,Arial,Sans-serif;
}
textarea{
color:#404040;
font-family:Arial,Helvetica,sans-serif;
font-size:12px;
}
td > button{
text-indent:8px;
}
Thank you very much for trying to help <3

Remove overflow:auto from id #wrapper for your image problem

For your first question, you can simply place both checkboxes in the same <td></td> to get them side-by-side. Change the code to:
<td width="35%"><input type="checkbox" name="citizen" value="yes">Yes<input type="checkbox" name="citizen" value="no">No</td>
As for the image, you don't seem to have included the code pertaining to it. If you could provide the code in context around this Form so I could see how the image is being placed, it would aid in discovering why it's moving.

Related

Creating a CSV from a web form output

I'm currently trying to make a web form such that when a user enters their information (they're applying for a service upgrade), their application will be put through to a CSV file.
I've created my web form, albeit very roughly as I'm not skilled in web dev/design. This is it here:
<!DOCTYPE html>
<html>
<style type="text/css">
.fieldset-auto-width {
display:inline;
}
form {
text-align: center;
}
select.my_dropdown {
width:130px;
}
</style>
<head>
<!-- head stuff goes here -->
<script src="users.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" ></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js" ></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" >
</head>
<body>
<h2 align="center"><u>Service Request Application Form</u></h2>
<hr>
<?php
if($_POST['formSubmit'] == "Submit Application")
{
$fn = $_POST['CustomerName'];
}
?>
<form method="post" align="center" name="myForm" id="applicationform" action="export.php">
<!--###################################### CONTACT INFORMATION FIELDSET ######################################-->
<fieldset style="border: 1px black solid">
<legend style="font-weight:bold"><u>Contact Information</u></legend>
<table>
<tr>
<th></th>
<th><u>Customer</u></th>
<th title="Electrician"><u>Consultant/Contractor</u></th>
</tr>
<tr>
<td>
<tr>
<td align="right" id="namelabel">Contact Name:</td>
<td><input type="text" id="customername" name="CustomerName" title="Name of contact on account"/></td>
<td><input type="text" id="contractorname" name="ContractorName" title="Name of contractor or consultant" /></td>
</tr>
<tr>
<td align="right" id="addresslabel">Mailing Address:</td>
<td><input type="text" id="customeraddress" name="CustomerMailingAddress" title="Enter your mailing address"/></td>
<td><input type="text" id="contractoraddress" name="ContractorMailingAddress" title="Enter your contractor's mailing address" /></td>
</tr>
<tr>
<td align="right" id="phonelabel">Phone Number:</td>
<td><input type="text" id="customerphone" name="CustomerPhoneNumber" title="Enter your phone number here" /></td>
<td><input type="text" id="contractorphone" name="ContractorPhoneNumber" title="Enter contractor's phone number here" /></td>
</tr>
<tr>
<td align="right" id="mobilephonelabel">Mobile Number:</td>
<td><input type="text" id="customermobilephone" name="CustomerMobilePhoneNumber" title="Enter your mobile phone number here"/></td>
<td><input type="text" id="contractormobilephone" name="ContractorMobilePhoneNumber" title="Enter contractor's mobile phone number here"/></td>
</tr>
<tr>
<td align="right" id="faxlabel">Fax:</td>
<td><input type="text" id="customerfax" name="CustomerFax" title="Enter fax information here" /></td>
<td><input type="text" id="contractorfax" name="ContractorFax" title="Enter fax information here"/></td>
</tr>
<tr>
<td align="right" id="emaillabel">E-mail:</td>
<td><input type="text" id="customeremail" name="CustomerEmail" title="Enter your email address here" /></td>
<td><input type="text" id="contractoremail" name="ContractorEmail" title="Enter contractor's email address here" /></td>
</tr>
<tr>
<td align="right" id="accountnumberlabel">Account Number:</td>
<td colspan="2"><input type="text" id="accountnumber" name="AccountNumber" size="46" title="Enter account number for requested upgrade here"/></td>
</tr>
</td>
</tr>
</table>
</fieldset>
<!--###################################### SERVICE INFORMATION FIELDSET ######################################-->
<fieldset style="border: 1px black solid">
<legend style="font-weight:bold"><u>Service Information</u></legend>
<table>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>
<tr>
<td align="right" id="serviceaddresslabel">Service Address:</td>
<td><input type="text" id="serviceaddress" name="ServiceAddress" title="Location of requested service"/></td>
</tr>
<tr>
<td align="right" id="unitlabel">Unit #:</td>
<td align="left"><input type="text" id="unitnumber" name="UnitNumber" title="Unit for requested service"/></td>
</tr>
<tr>
<td align="right" id="servicetypelabel">Service Type:</td>
<td align="left">
<select class="my_dropdown" name="ServiceType" id="servicetype" title="Select the type of service you require">
<option value="-1" selected>[select--service]</option>
<option value="1">Upgrade</option>
<option value="2">Temporary</option>
<option value="3">New Permanent</option>
<option value="4">Other</option>
</select>
</td>
</tr>
<tr>
<td align="right" id="customerclasslabel">Customer Class:</td>
<td align="left">
<select class="my_dropdown" name="CustomerClass" id="customerclass" title="Select the type of account the service is for">
<option value="-1" selected>[select--type]</option>
<option value="1">Residential</option>
<option value="2">Commercial</option>
<option value="3">Industrial</option>
</select>
</td>
</tr>
<tr>
<td align="right" id="proposedloadlabel">Proposed Load:</td>
<td align="left"><input type="text" id="proposedload" name="ProposedLoad" size="10" title="Enter the proposed Kilowatt load the upgrade will handle"/>kW</td>
</tr>
<tr>
<td align="right" id="proposedmainlabel">Proposed Main Switch:</td>
<td align="left"><input type="text" id="proposedmainswitch" name="ProposedMainSwitch" size="10" title="Enter the proposed Amperage (Amps) load the main switch will handle"/>A</td>
<td align="left" id="existingmainlabel">Existing Main Switch:</td>
<td align="left"><input type="text" id="existingmainswitch" name="ExistingMainSwitch" title="Enter the current Amperage load the main switch handles"size="10"/>A</td>
</tr>
<tr>
<td align="right" id="voltagelabel">Voltage:</td>
<td align="left">
<select class="my_dropdown" name="Voltage" id="voltage" title="Select the Voltage rating required">
<option value="-1" selected>[select--voltage]</option>
<option value="1">240/120V</option>
<option value="2">208/120V</option>
<option value="3">600/347V</option>
</select>
</td>
</tr>
<tr>
<td align="right" id="phaselabel">Phase:</td>
<td align="left">
<select class="my_dropdown" name="Phase" id="phase" title="Select the upgrade phase preferred">
<option value="-1" selected>[select--phase]</option>
<option value="1">Single-Phase</option>
<option value="2">Three-Phase</option>
</select>
</td>
</tr>
<tr>
<td align="right" id="powersupplylabel">Power Supply:</td>
<td align="left">
<select class="my_dropdown" name="PowerSupply" id="powersupply" width="90" title="Select position of power supply required">
<option value="-1" selected size>[select--supply]</option>
<option value="1">Overhead (OH)</option>
<option value="2">Underground (UG)</option>
<option value="3">OH to UG</option>
<option value="4">UG to OH</option>
</select>
</td>
</tr>
<tr>
<td align="right" id="meterbaselabel">Meter Base Location:</td>
<td align="left">
<select class="my_dropdown" name="MeterBaseLocation" id="MeterBaseLocation" title="Select the location of the Meter">
<option value="-1" selected>[select--location]</option>
<option value="1">Existing Outside</option>
<option value="2">Inside Moving Out</option>
<option value="3">Relocate</option>
<option value="4">Ganged Position*</option>
</select>
<td align="left"><input type="text" id="existingmainswitch" name="ExistingMainSwitch" size="5" title="If meter location requires a Ganged (multiple) position installation, how many positions are needed?"/>*Positions</td>
</td>
</tr>
</td>
</tr>
</table>
</fieldset>
<table>
<tr>
<td align="center" id="commentslabel" title="Anything you want to add? Tell us here"><b><u>Comments/Reason for Upgrade:</b></u></td>
</tr>
<tr>
<td><textarea align="center" id="comments" rows="4" cols="80" style="border: 1px black solid" title="Anything you want to add? Tell us here"></textarea></td>
</tr>
<tr>
<td align="left">
<input type="checkbox" align="left" id="consent" value="consent1"><b> I confirm that the information I have given in this form is true to the best of my knowledge.</b><br>
<input type="checkbox" align="left" id="consent" value="consent2"><b>
I acknowledge and accept that if we schedule the connection to be done after hours (3:30PM) a charge
of $415 + HST will be added to my electricity bill for the month. </b><br>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="formSubmit" value="Submit Application"></td>
</tr>
</table>
</form>
</body>
I've created a 'starter' file to test my form. I've only included a few variables for field testing as I'm not sure if I'm doing it the right way to output it to a CSV file. (CSV output required by employer)
Here is my action handler file named export.php:
<?php
$fn = $_POST['customername'];
$ln = $_POST['contractorname'];
// $address = $_POST['address'];
//validate
if(empty($fn) || empty($ln) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($phone) || empty($email)){//show the form
$message = 'Fill in areas in red!';
$aClass = 'errorClass';
}
//this is where the creating of the csv takes place
$cvsData = $fn . "," . $ln ."\n";
$fp = fopen("formTest.csv","a"); // $fp is now the file pointer to file $filename
if($fp){
fwrite($fp,$cvsData); // Write information to the file
fclose($fp); // Close the file
}
?>
I am trying to output to a file for testing named formTest.csv. Currently I believe I'm having issues with PHP on my PC at work, as the network admins restrict access on our computers they were the ones who set it up while I was away. Currently when I click submit it just opens my export.php page, which is why I say my issue is PHP on my machine. But when I tested this on my home PC which SHOULD have PHP working (but it has been a while), it would return to my form but nothing would be input into the CSV.
Any tips?

Getting a redirect on webpage when using file_get_contents()

I recently purchased the WS-1400-IP weather station from Ambient Weather that links up to Weather Underground. I am attempting to do a DOM query on the HTML of the IP link device. Here is my code:
(I know its very crude code, it's just a preliminary thing).
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$filename = "http://10.175.3.28/bscsetting.htm";
$html = file_get_contents($filename);
echo "<input type=text value='{$html}'></input>";
$dom = new DOMDocument();
#$dom->loadHTML($html);
$x = new DOMXPath($dom);
$data = array();
foreach($x->query("//input") as $node)
{
$data[][$node->getAttribute("name")] = $node->getAttribute("value");
}
echo json_encode($data, JSON_PRETTY_PRINT);
And this is what I am seeing when I echo the HTML I am getting from the device:
<input type=text value='ction: Keep-Alive
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta http-equiv="refresh" content="0;URL=./bscsetting.htm">
<title></title>
<body leftmargin="80" topmargin="80" marginwidth="80" marginheight="0" bgcolor="#333">
<font size="+3"><strong><p align="center"></p></strong></font>
</body>
</html>
'></input>[
]
And here is what I should be seeing (as this is what I see when I use a regular browser):
<!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=utf-8" />
<title>LiveData</title>
<link href="axcss0.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="right" bgcolor="#0088F7"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20" height = "80"> </td>
<td ><img src="img/1.jpg" width="74" height="80" ></td>
<td width="10"> </td>
<td class="txtstyle_1" >ambient weather observerIP 2.0 </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#60B7FF"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="120" align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><em>Version:2.0.0</em></font></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#C0C0C0">
<table width="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#C0C0C0"><div class="menuitem_1">Local Network</div></td>
<td bgcolor="#C0C0C0"><div class="menuitem_1">Weather Network</div></td>
<td bgcolor="#C0C0C0"><div class="menuitem_1">Station Settings</div></td>
<td bgcolor="#EDEFEF"><div class="menuitem_1">Live Data</div></td>
<td bgcolor="#C0C0C0"><div class="menuitem_1">Calibration</div></td>
</tr>
</table>
</td>
</tr>
<form name="livedata" method="POST" onsubmit="return chkForm(0);">
<tr>
<td colspan="2" bgcolor="#EDEFEF"><div class="subitem_1">Live Data</div></td>
</tr>
<tr>
<td width="533" bgcolor="#EDEFEF"><div class="item_1">Receiver Time:</div></td>
<td width="307" bgcolor="#EDEFEF">
<input name="CurrTime" disabled="disabled" type="text" class="item_2" style="WIDTH: 120px" value="16:34 03/04/2015" maxlength="16"/></td>
</tr>
<tr>
<td width="533" bgcolor="#EDEFEF"><div class="item_1">Indoor Sensor ID</div></td>
<td width="307" bgcolor="#EDEFEF"><input name="IndoorID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x19" maxlength="4" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Outdoor Sensor1 ID</div></td>
<td bgcolor="#EDEFEF"><input name="Outdoor1ID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x94" maxlength="4" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Outdoor Sensor2 ID</div></td>
<td bgcolor="#EDEFEF"><input name="Outdoor2ID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x--" maxlength="4" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Indoor Temperature</div></td>
<td bgcolor="#EDEFEF"><input name="inTemp" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="71.2" maxlength="5" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Indoor Humidity</div></td>
<td bgcolor="#EDEFEF"><input name="inHumi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="48" maxlength="3" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Absolute Pressure </div></td>
<td bgcolor="#EDEFEF"><input name="AbsPress" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="29.23" maxlength="6" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Relative Pressure </div></td>
<td bgcolor="#EDEFEF"><input name="RelPress" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="30.29" maxlength="6" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Outdoor Temperature</div></td>
<td bgcolor="#EDEFEF"><input name="outTemp" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="34.2" maxlength="5" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Outdoor Humidity </div></td>
<td bgcolor="#EDEFEF"><input name="outHumi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="97" maxlength="3" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Wind Direction </div></td>
<td bgcolor="#EDEFEF"><input name="windir" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="228" maxlength="5" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Wind Speed </div></td>
<td bgcolor="#EDEFEF"><input name="avgwind" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="10.3" maxlength="5" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Wind Gust </div></td>
<td bgcolor="#EDEFEF"><input name="gustspeed" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="12.3" maxlength="5" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Solar Radiation </div></td>
<td bgcolor="#EDEFEF"><input name="solarrad" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="17.30" maxlength="12" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">UV </div></td>
<td bgcolor="#EDEFEF"><input name="uv" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="68" maxlength="12"></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">UVI </div></td>
<td bgcolor="#EDEFEF"><input name="uvi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0" maxlength="2"></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Hourly Rain Rate</div></td>
<td bgcolor="#EDEFEF"><input name="rainofhourly" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0.07" maxlength="7" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Daily Rain</div></td>
<td bgcolor="#EDEFEF"><input name="rainofdaily" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="1.81" maxlength="7" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Weekly Rain</div></td>
<td bgcolor="#EDEFEF"><input name="rainofweekly" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="2.10" maxlength="7" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Monthly Rain</div></td>
<td bgcolor="#EDEFEF"><input name="rainofmonthly" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="2.10" maxlength="7" /></td>
</tr>
<tr>
<td bgcolor="#EDEFEF"><div class="item_1">Yearly Rain</div></td>
<td bgcolor="#EDEFEF"><input name="rainofyearly" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="2.10" maxlength="7" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#EDEFEF"> </td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#EDEFEF">
<input name="rain_Default" type="button" class="item_2" style="WIDTH: 110px; HEIGHT: 24px;" onclick="raindef()" value="Rain Reset">
<input id="refresh_st" type="button" class="item_4" style="WIDTH: 110px; HEIGHT: 24px;" onclick="uiCtrl(this.value);" value="Refresh" />
<input id="refresh_sp" type="button" class="item_2" style="WIDTH: 110px; HEIGHT: 24px;" onclick="uiCtrl(this.value);" value="Stop Refresh" />
</td>
</tr>
</form>
<tr>
<td colspan="2" bgcolor="#EDEFEF"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#C0C0C0"> </td>
</tr>
</table>
<script src="axjs0.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
var rfTaskRuningFlag = 0, rfTimeId;
uiCtrl('Refresh');
function uiCtrl(uiCmd)
{
if (uiCmd=='Refresh'){
document.getElementById('refresh_st').disabled = true;
document.getElementById('refresh_sp').disabled = false;
rfTaskRuningFlag = 1;
rfTaskState = 0;
rfTimeId = setInterval("ss()",8000);
}else if (uiCmd=='Stop Refresh'){
document.getElementById('refresh_st').disabled = false;
document.getElementById('refresh_sp').disabled = true;
rfTaskRuningFlag = 0;
clearInterval(rfTimeId);
}
}
function ss()
{
if (rfTaskRuningFlag)
{
window.top.location.reload();
}
}
//-->
</script>
</body>
</html>
How do I get past the meta refresh? Any ideas?
EDIT: After trying curl, it works as expected.. Why would it make a difference?
They have an API and use JSON with RESTful protocol. You need to send your api key in your request to authenticate your server with their’s. It’s all free and can then specify what data you’re looking for both past and present. You can then display on your webpage or save to your database

PHP Form issue - using MySQL database on PHP form

I am a .NET guy. I am asked to fix a PHP form issue, can you please help me to figure-out db connection issue in the code if any.
I have a page connect.php having following code:-
<?php
$link = mysqli_connect("100.100.10.92","CountryCabs_123","Country!23Cabs_123","newdb1");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Now I've a form with following infomation:-
<?php error_reporting(0); include("connect.php"); ?>
<?php
include('header.php');
?>
<div class="main">
<div style="width:100%;">
<div id="div2">
<div class="head1">Book Your Cab</div>
<div class="content1">
<form name="bookcab" id="bookcab" method="post" >
<table width="100%">
<tr >
<td colspan="4"><div class="titlehead">Local Booking</div></td>
</tr>
<tr>
<td colspan="4"><div><span
style="color:#FF0000">*</span> Mandatory Feilds</div></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td width="15%">CITY</td>
<td width="34%"><select id="size3" name="from3">
<option value="Pune">Pune</option>
</select></td>
<td width="12%" align="right">PACKAGE<span
style="color:#FF0000">*</span></td>
<td width="39%"><select id="size4" name="packages">
<option value="0">Hr/Kms</option>
<?php $select= mysql_query("select * from local_packages");
$i=1;
while($sel= mysql_fetch_assoc($select))
{
?>
<option value="<?php echo
$sel['package_name'];?>"><?php echo $sel['package_name'];?></option>
<?php $i++;}?>
</select></td>
</tr>
<tr>
<td width="15%">Cab Type <span style="color:#FF0000">*</span> :</td>
<td width="39%"><select name="cabtype" id="cabtyp" >
<option value="0">CabType</option>
<option value="Hatchback">HatchBack</option>
<option value="Compact">Compact Sedan</option>
<option value="Sedan">Sedan</option>
<option value="MUV">MUV</option>
</select></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td colspan="4" style="padding-left:5px"><h4>When</h4></td>
</tr>
<tr>
<td style="padding-left:5px">Pickup Date<span
style="color:#FF0000; margin:0px 22px 0px 0px">*</span> : </td>
<td> <span class="k-textbox" style="width:200px"><input
name="datepicker" id="datepicker" class="tcal" value="<?php echo
$_SESSION['date'];?>"/></span></td>
<td width="28%"><span style="padding-left:20px">Pickup Time <span
style="color:#FF0000; margin:0px 35px 0px 0px">*</span> :</td>
<td><input name="timepicker" id="timepicker" value="<?php echo
$_SESSION['time'];?>" style="width:200px"/>
<script>
$(document).ready(function() {
// create TimePicker from input HTML element
$("#timepicker").kendoTimePicker();
});
</script></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td style="padding-left:5px">Pickup Address <span
style="color:#FF0000">*</span> :</td>
<td colspan="3"><select name="pickup" id="pickup"
onchange="selectAdd(this.value)" style="width:200px">
<option value="Home">Home</option>
<option value="Office">Office</option>
<option value="Railway">Railway Station</option>
<option value="Airport">Airport</option>
</select></td>
</tr>
<?php $select= mysql_query("select * from member where
pkey='".$_SESSION['regId']."'");
$selected= mysql_fetch_assoc($select);?>
<tr>
<td > </td>
<td colspan="3"><textarea name="pickupaddress"
class="k-textbox" style="width:300px; height:100px" id="pick"><?php
echo $selected['per_address'];?></textarea></td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4"><div class="border1"></div></td>
</tr>
<tr>
<td colspan="2" style="padding-left:5px"><h4>Traveller's
Details</h4></td>
<td colspan="2"> </td>
</tr>
<?php $select= mysql_query("select * from member where pkey=
'".$_SESSION['regId']."'");
$list= mysql_fetch_assoc($select); ?>
<tr>
<td colspan="4" ><input type="radio" name="self"
value="self" onclick="addDetails('<?php echo $list['firstname']."
".$list['lastname']?>','<?php echo $list['mobile']; ?>','<?php echo
$list['email'];?>','<?php echo $list['company'];?>')"
checked="checked">
Booking For Self
<input type="radio" name="self" value="other"
onclick="addDetails('','','','')">
Booking For Others</td>
</tr>
<tr>
<td width="18%" style="padding-left:5px">Name
<span style="color:#FF0000 ; margin:0px 52px 0px 0px"> * </span>:</td>
<td><span class="k-textbox" style="width:200px">
<input type="text" name="name" id="name"
value="<?php echo $list['firstname']." ".$list['lastname'];?>" >
</span> </td>
<td width="28%"><span style="margin:0px 0px 0px
20px">Mobile No.<span style="color:#FF0000; margin:0px 47px 0px
0px">*</span> : </span></td>
<td width="38%"><span class="k-textbox" style="width:200px">
<input type="text" name="mobile" id="mobile"
value="<?php echo $list['mobile'];?>" onKeyPress="return
isNumberKey(event)"><script type="text/javascript">function
isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}</script>
</span></td>
</tr>
<tr>
<td width="18%" style="padding-left:5px">Email ID
<span style="color:#FF0000; margin:0px 42px 0px 0px">*</span>: </td>
<td width="18%"><span class="k-textbox" style="width:200px">
<input type="text" name="email" id="email"
value="<?php echo $list['email'];?>">
</span></td>
<td width="28%" ><span style="margin:0px 0px 0px
20px">Company </span><span style="margin:0px 0px 0px
57px">:</span></td>
<td width="38%"><span class="k-textbox" style="width:200px">
<input type="text" name="company" id="company"
value="<?php echo $list['company'];?>">
</span></td>
</tr>
<tr>
<td style="padding-left:5px">Lead<span style="margin:0px
0px 0px 69px">:</span></td>
<td colspan="3"> <select name="lead" id="lead" style="width:200px">
<option value="0">Select</option>
<option value="Website">Website</option>
<option value="Referal">Referal</option>
<option value="Facebook">Facebook</option>
<option value="Twitter">Twitter</option>
<option value="LinkedIn">LinkedIn</option>
<option value="Others">Others</option>
</select> </td>
</tr>
<tr>
<td colspan="4" style="padding-left:5px"><div id="planes"
style="display:none;"> Flight No.: <span class="k-textbox"
style="margin:0px opx 0px 69px">
<input type="text" name="planess" id="planess"
value="" style="width:195px">
</span> </div>
<div id="train" style="display:none;"> Train
No.: <span class="k-textbox"
style="margin-left:50px;width:200px" >
<input type="text" name="trainNo" id="trainNumber"
value="" style="width:195px">
</span> </div></td>
</tr>
<tr>
<td valign="top" style="padding-left:5px">Special
Requirements<span style="margin:0px 0px 0px 18px">:</span></td>
<td colspan="3" >
<textarea class="k-textbox" style="width:300px;
height:100px" id="requ" placeholder="Eg: Clean and Ac Car"></textarea>
</td>
</tr>
<tr>
<td ></td>
<td colspan="3">
<input type="button" name="book" id="book" value=" Book "
onclick="confirm_book_local()" style="float:inherit"
class="btn"></td>
</tr>
</table>
</form>
</div>
</div>
<!--------confim------->
<div style="display:none;" id="div3">
<div class="head1">Booking Details</div>
<div class="content1">
<form name="confirmation" id="confirmation" method="post"
action="submit-form-local.php">
<table width="100%" height="auto" border="0" cellpadding="6"
cellspacing="0" >
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="22%"><strong>Traveller's Name</strong></td>
<td width="2%"><strong>:</strong></td>
<td width="72%"> <input type="text" name="dname" id="dname"
style="border:none; background-color:transparent; width:400px;"
readonly/></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px; font-weight:bold">Email
ID</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" ><input
type="text" id="dmail" name="dmail" style="border:none;
background-color:transparent; width:220px;" readonly></span></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px;font-weight:bold">Mobile
No</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" >
<input type="text" id="dmobile" name="dmobile"
style="border:none ;background-color:transparent; width:150px;"
readonly/>
</span></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px;font-weight:bold">Cab
Type</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" >
<input type="text" id="dcabtype" name="dcabtype"
style="border:none ;background-color:transparent; width:150px;"
readonly/>
</span></td>
</tr>
<tr>
<td ><h4>City</h4></td>
<td ><strong>:</strong></td>
<td><input type="text" name="city" value="Pune"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td><h4>Pickup Address</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="dpick" id="dpick"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<td><h4>Departure Date</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="Pdate" id="Pdate"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<td><h4>Departure Time</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="Ptime" id="Ptime"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td><h4>Special Requirements</h4></td>
<td><strong>:</strong></td>
<td><input type="text" id="special" name="special"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td ><input type="checkbox" name="accept" id="accept">
I have Read And Accept The <a href="termsconditions.php"
target="_blank">Terms And Conditions</a></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="radio" name="pay" value="cos"
onchange="display_message(1)" checked="checked">
<strong>Cash On Service</strong>
<input type="radio" name="pay" value="pay_now"
onchange="display_message(2)">
<strong> Pay Online</strong></td>
</tr>
<tr>
<td></td>
<td></td>
<td id="m1" style="display:none; color:#FF0000">Extremely Sorry!
Online payment mode is temporarily down, please select cash on
service as of now. We regret for the inconvenience you had.</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" name="confirm" id="con1"
value="Confirm" style="float:left;margin-right:20px;" class="btn"
onclick="validCondition()">
<input type="button" name="back" value="Back" style="float:left;"
class="btn" onclick="bookback()"> </td>
</tr>
<tr>
<td></td>
<td></td>
<td style="margin-left:20px">You can cancel your booking
anytime. Please read our <a href="cancellation_ privacy.php"
target="_blank">cancellation policy</a> for more details.</td>
</tr>
<tr><td><input type="hidden" name="hiddencarId" value="<?php echo
$_GET['id'];?>"></td>
<td> </td>
</tr>
</table>
</div>
</div>
</div>
<div class="clear"></div>
<?php include('footer.php');?>
<script>
document.getElementById('li05').classList.add('active');
</script>
There is some user accessibility issue on database, we are using GoDaddy. I verified the credentials on MySQL Workbench i can connect database. Can you please verify if any issue in code.
You're mixing mysqli with mysql. Should be using mysqli only instead of mysql, which is already deprecated. And when using mysqli, it is best (and a must) to be doing prepared statement on it to prevent SQL injections.
I'll be doing the first drop down for an example, so you can have an idea and do the rest.
<select id="size4" name="packages">
<option value="0">Hr/Kms</option>
<?php
$select= "SELECT package_name FROM local_packages";
if($stmt=$link->prepare($select)){
$stmt->execute();
$stmt->bind_result($packagename); /* BIND THE RESULT */
$i=1;
while($stmt->fetch()){ /* FETCH RESULTS */
printf("<option value='%s'>%s</option>",$packagename,$packagename);
$i++;
} /* END OF WHILE LOOP */
$stmt->close();
}
?>
</select>
I still included the $i variable. Maybe you have other purpose for it.

Registration form will not submit data to database if I use action attribute to open a confirmation page

My code will submit data to my database if I use action="", but I want the action attribute to open a confirmation page to let users know their data has been registered. This confirmation page should appear onclick of the submit button and only after user's data has been stored in my database. My code will not submit data to my database if I use action="regconfirm.html" (which is my confirmation page), but the confirmation page opens like it should. I have tried to use onsubmit="location.href='...registerform/regconfirm.html'" and onclick="location.href='...registerform/regconfirm.html'" in the submit tag. This also doesn't submit data to my database. The form has many text fields and radio buttons which all work perfectly and validation is done using the required attribute in each field object's tag. I believe the problem is in the form tag I am providing all code in the body here.
<body>
**<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form" id="form">**
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"> </td>
<td width="497" colspan="2"> </td>
</tr>
<tr>
<td colspan="3" align="left" valign="top">(สามารถถ่ายเอกสารได้)</td>
<td colspan="2" rowspan="3" align="right"><table width="344" border="4" align="right" cellpadding="2" cellspacing="0" class="tableborder">
<tr>
<td width="306" colspan="2" align="right"><table width="326" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="right">ใบเสร็จรับเงินเลขท
<input name="text_1" type="text" class="formfield" id="text_1" value="<?php echo $row_Recordset1['text_1']; ?>" size="25" maxlength="255" autofocus required/></td>
</tr>
<tr>
<td align="right">ลงวันท
<input name="text_2" type="text" class="formfield" id="text_2" value="<?php echo $row_Recordset1['text_2']; ?>" size="25" maxlength="255" required/></td>
</tr>
<tr>
<td align="right">จำนวนเงิน
<input name="text_3" type="text" class="formfield" id="text_3" value="<?php echo $row_Recordset1['text_3']; ?>" size="25" maxlength="255" required/></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td height="33" colspan="3"> </td>
</tr>
<tr>
<td height="102" colspan="5" align="right"><img src="images/heading.jpg" alt="heading" width="731" height="96" align="absbottom" /></td>
</tr>
<tr>
<td width="87" align="left"><strong>ท่านเป็น</strong></td>
<td colspan="4" align="right">
<input name="RadioGroup2" type="radio" id="radio_1" value="Medicine" required/>
แพทย์
<input name="RadioGroup2" type="radio" id="radio_2" value="Nurse" required/>
พยาบาล
<input name="RadioGroup2" type="radio" id="radio_3" value="Academic" required/>
นักวิชาการ
<input name="RadioGroup2" type="radio" id="radio_4" value="Other" required/>
อื่นๆ
<input name="text_4" type="text" class="formfield" id="text_4" value="<?php echo $row_Recordset1['text_4']; ?>" size="49" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td width="84"> </td>
<td width="1"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="left">ชื่อ..(โปรดระบุคำนำหน้า)</td>
<td colspan="3" align="right"><input name="text_5" type="text" class="formfield" id="text_5" value="<?php echo $row_Recordset1['text_5']; ?>" size="84" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5">โรงพยาบาล
<input name="text_6" type="text" class="formfield" id="text_6" value="<?php echo $row_Recordset1['text_6']; ?>" size="40" maxlength="255" required/></td>
<td colspan="5" align="right">แผนก/หน่วย/ภาควิชา
<input name="text_7" type="text" class="formfield" id="text_7" value="<?php echo $row_Recordset1['text_7']; ?>" size="29" maxlength="255" required/></td>
</tr>
<tr>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="50"> </td>
<td width="70"> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="266">เลขใบประกอบวิชาชีพ (แพทย์ / พยาบาล)</td>
<td width="417" align="right"><input name="text_8" type="text" class="formfield" id="text_8" value="<?php echo $row_Recordset1['text_8']; ?>" size="71" maxlength="255" required/></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="169">เลขที่สมาชิกสภาพยาบาล</td>
<td width="514" colspan="7" align="right"><input name="text_9" type="text" class="formfield" id="text_9" value="<?php echo $row_Recordset1['text_9']; ?>" size="87" maxlength="255" required/></td>
</tr>
<tr>
<td colspan="8"> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="99">ที่อยู่ที่ติดต่อได้</td>
<td width="612" colspan="8" align="right"><input name="text_10" type="text" class="formfield" id="text_10" value="<?php echo $row_Recordset1['text_10']; ?>" size="98" maxlength="255" required/></td>
</tr>
<tr>
<td colspan="9"> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="41">มือถือ</td>
<td width="642" align="right"><input name="text_11" type="text" class="formfield" id="text_11" value="<?php echo $row_Recordset1['text_11']; ?>" size="108" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="295">โทรศัพท์
<input name="text_12" type="text" class="formfield" id="text_12" value="<?php echo $row_Recordset1['text_12']; ?>" size="35" maxlength="255" required/></td>
<td width="388" align="right">โทรสาร
<input name="text_13" type="text" class="formfield" id="text_13" value="<?php echo $row_Recordset1['text_13']; ?>" size="53" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="42">E-mail: </td>
<td width="641" align="right"><input name="text_14" type="email" class="formfield" id="email" value="<?php echo $row_Recordset1['text_14']; ?>" size="108" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="290">หากสนับสนุนโดยบริษัท (โปรดระบุ) ชื่อผู้แทน</td>
<td width="393" align="right"><input name="text_15" type="text" class="formfield" id="text_15" value="<?php echo $row_Recordset1['text_15']; ?>" size="66" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="52">โทรศัพท์</td>
<td width="631" align="right"><input name="text_16" type="text" class="formfield" id="text_16" value="<?php echo $row_Recordset1['text_16']; ?>" size="105" maxlength="255" required/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="123"><strong><u>รับประเภทอาหาร</u></strong></td>
<td width="15"> </td>
<td width="51">
<input name="RadioGroup1" type="radio" id="radio_5" value="Thailand" required/>
ไทย</td>
<td width="1"> </td>
<td width="76">
<input type="radio" name="RadioGroup1" value="Vegetarian" id="radio_6" required/>
มังสวิรัติ</td>
<td width="101">
<input type="radio" name="RadioGroup1" value="Islam" id="radio_7" required/>
อิสลาม</td>
<td width="216"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="729" border="4" align="center" cellpadding="0" cellspacing="0" class="blueborder_two">
<tr>
<td colspan="6"><table border="0" cellspacing="0" cellpadding="0" width="692">
<tr>
<td width="347" valign="top"><p align="center"><strong>อัตราค่าลงทะเบียน (บาท)</strong></p></td>
<td width="95" valign="top"><p align="center"><strong><u>ก่อน</u></strong><strong>  </strong><br />
<strong>15  มี.ค.57</strong></p></td>
<td width="104" valign="top"><p align="center"><strong><u>ตั้งแต่</u></strong><strong> </strong><strong> </strong><br />
<strong>15 มี.ค.57</strong></p></td>
<td width="95" valign="top"><p align="center"><strong><u>หน้างาน</u></strong></p></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6"><table border="0" cellspacing="0" cellpadding="0" width="692">
<tr>
<td height="37" colspan="4" valign="middle"><span class="numbertext"><strong><img src="images/space.jpg" width="6" height="9" alt="space" />1</strong></span><strong>. <span class="numbertext">Pre-congress workshops</span>    (เลือกได้ 1 หัวข้อเท่านั้น)</strong></td>
</tr>
<tr valign="middle">
<td width="341" height="15" class="numbertext"><input type="radio" name="RadioGroup3" value="1" id="RadioGroup3_0" required/>
<strong>1</strong></td>
<td width="93" class="numbertext"><input type="radio" name="RadioGroup4" value="2000" id="RadioGroup4_0" required/>
2000</td>
<td width="95" class="numbertext"><label>
<input type="radio" name="RadioGroup4" value="2300" id="RadioGroup4_1" required/>
2300</label></td>
<td width="77"><input type="radio" name="RadioGroup4" value="2800" id="RadioGroup4_2" required/>
<span class="numbertext">2800</span></td>
</tr>
<tr valign="middle">
<td height="40" class="numbertext"><input type="radio" name="RadioGroup3" value="2 " id="RadioGroup3_1" required/>
<strong>2
<label>
<input type="radio" name="RadioGroup3" value="3" id="RadioGroup3_2" required/>
<strong>3</strong></label>
<input type="radio" name="RadioGroup3" value="4" id="RadioGroup3_3" required/>
<strong>4</strong></strong></td>
<td width="93" class="numbertext"><input type="radio" name="RadioGroup5" value="1000" id="RadioGroup5_0" required/>
1000</td>
<td width="95" class="numbertext"><input type="radio" name="RadioGroup5" value="1300" id="RadioGroup5_1" required/>
1300</td>
<td width="77" class="numbertext"><label>
<input type="radio" name="RadioGroup5" value="1800" id="RadioGroup5_2" required/>
1800</label></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6"><table border="0" cellspacing="0" cellpadding="0" width="692">
<tr>
<td height="37" colspan="4" valign="middle"><strong> <span class="numbertext"><img src="images/space.jpg" width="6" height="9" alt="space" />2</span>. ประชุมวิชาการ  <span class="numbertext">(Main Congress) </span></strong></td>
</tr>
<tr valign="middle">
<td width="341" height="30"><strong> <img src="images/space.jpg" width="6" height="9" alt="space" /><img src="images/bullet.jpg" width="8" height="8" alt="bullet" /> เป็นสมาชิกสมาคมเวชศาสตร์มารดาฯเลขที่......</strong></td>
<td width="93" class="numbertext"><input type="radio" name="RadioGroup6" value="1700" id="RadioGroup6_0" required/>
1700</td>
<td width="96" class="numbertext"><label>
<input type="radio" name="RadioGroup6" value="2000" id="RadioGroup6_1" required/>
2000</label></td>
<td width="76" class="numbertext"><strong>
<input type="radio" name="RadioGroup6" value="2500" id="RadioGroup6_2" required/>
</strong>2500</td>
</tr>
<tr valign="middle">
<td height="30"><strong><img src="images/space.jpg" width="6" height="9" alt="space" /><img src="images/bullet.jpg" width="8" height="8" alt="bullet" /></strong><strong>ไม่ได้เป็นสมาชิกสมาคมเวชศาสตร์มารดาฯ</strong><strong> </strong></td>
<td width="93" class="numbertext"><label>
<input type="radio" name="RadioGroup7" value="2200" id="RadioGroup7_0" required/>
2200</label></td>
<td width="96" class="numbertext"><label>
<input type="radio" name="RadioGroup7" value="2500" id="RadioGroup7_1" required/>
2500</label></td>
<td width="76" class="numbertext"><input type="radio" name="RadioGroup7" value="3000" id="RadioGroup7_2" required/>
3000</td>
</tr>
<tr valign="middle">
<td height="30"><strong><img src="images/space.jpg" width="6" height="9" alt="space" /><img src="images/bullet.jpg" width="8" height="8" alt="bullet" /> สำหรับ Resident / Fellow</strong></td>
<td class="numbertext"><input type="radio" name="RadioGroup8" value="800" id="RadioGroup8_0" required/>
800</td>
<td class="numbertext"><input type="radio" name="RadioGroup8" value="1000" id="RadioGroup8_1" required/>
1000</td>
<td class="numbertext"><input type="radio" name="RadioGroup8" value="1500" id="RadioGroup8_2" required/>
1500</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6"><table border="0" cellspacing="0" cellpadding="0" width="692">
<tr>
<td height="37" colspan="5" valign="middle"><span class="numbertext"><strong><img src="images/space.jpg" width="6" height="9" alt="space" />3</strong></span><strong>. </strong><strong>สมัครสมาชิกสมาคมฯ ตลอดชีพ</strong></td>
</tr>
<tr>
<td width="250" height="50" valign="top" class="numbertext"><em class="bluetext"><img src="images/space.jpg" width="6" height="9" alt="space" />(ดาวน์โหลดใบสมัครสมาชิกสมาคมฯ  และส่ง<img src="images/space.jpg" width="6" height="9" alt="space" />มาพร้อมกับใบลงทะเบียนประชุม)</em></td>
<td width="80" valign="top" class="numbertext"> </td>
<td width="90"><label>
<input type="radio" name="RadioGroup9" value="800 " id="RadioGroup9_0" required/>
<span class="numbertext">800</span></label>
<br />
</td>
<td width="95" class="numbertext"><label>
<input type="radio" name="RadioGroup9" value="800 " id="RadioGroup9_1" required/>
800</label>
<br />
</td>
<td width="71"><span class="numbertext">
<label>
<input type="radio" name="RadioGroup9" value="800" id="RadioGroup9_2" required/>
800</label>
<br />
<strong></strong></span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6"><table width="692" border="0" cellpadding="0" cellspacing="0">
<tr>
<?php
$sql = 'UPDATE regform SET `total` = `radio_12` + `radio_15` + `radio_18` + `radio_21` +`radio_24` + `radio_27`';
?>
<td height="46" align="right"><strong>รวมค่าลงทะเบียน ข้อ <span class="numbertext">1+2+3</span>
<input name="text_17" type="text" class="formfield" id="text_17" value="<?php echo $row_Recordset1['total']; ?>" maxlength="255" required/>
<em><strong>บาท</strong></em></strong></td>
</tr>
</table></td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>ต้องการให้ออกใบเสร็จในนาม  (ระบุ) </td>
<td align="right"><input name="text_18" type="text" class="formfield" id="text_18" value="<?php echo $row_Recordset1['text_18']; ?>" size="76" maxlength="255" required/></td>
</tr>
</table>
<table width="729" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td colspan="2"> </td>
<td width="63"> </td>
</tr>
<tr>
<td colspan="3"><strong class="yellowhighlight"><u>การชำระเงิน</u></strong>  <u> เมื่อสมาคมฯได้รับชำระเงินแล้วเท่านั้น จึงถือว่าการลงทะเบียนสมบูรณ์ </u></td>
</tr>
<tr>
<td width="26" valign="top"><input type="radio" name="RadioGroup10" value="Bank Transfer" id="RadioGroup10_0" required/>
<span class="paymenttext">Bank Transfer</span></td>
<td colspan="2">โอนเข้าบัญชี    “ <u>วิชาการสมาคมเวชศาสตร์มารดาและทารกในครรภ์ (ไทย)”</u>      ธนาคารกรุงไทย บัญชีออมทรัพย์   <br />
เลขที่  <u>041-0-08598-7</u>   สาขา <u>ถนนเพชรบุรีตัดใหม่</u></td>
</tr>
<tr>
<td valign="top"><input type="radio" name="RadioGroup10" value="Money Order" id="RadioGroup10_1" required/>
<span class="paymenttext">Money Order</span></td>
<td colspan="2"><label>ธนาณัติสั่งจ่าย</label>
  <u>ปณ. เพชรบุรีตัดใหม่ </u><u>10311</u>   ในนาม <u>ศ.นพ.เยื้อน  ตันนิรันดร</u>  และส่งธนาณัติตัวจริงพร้อมใบลงทะเบียน  <br />
มายังสมาคมฯ</td>
</tr>
<tr>
<td valign="top"><input type="radio" name="RadioGroup10" value="Cheque" id="RadioGroup10_2" required/>
<span class="paymenttext">Cheque</span></td>
<td colspan="2"> เช็คสั่งจ่าย(เช็คต่างจังหวัดเพิ่มค่าธรรมเนียม 30 บาท) บัญชี<u>วิชาการสมาคมเวชศาสตร์มารดาและทารกในครรภ์</u><u>(ไทย)</u></td>
</tr>
<tr>
<td valign="top"><input type="radio" name="RadioGroup10" value="Cash" id="RadioGroup10_3" required/>
<span class="paymenttext">Cash</span></td>
<td width="579"><label>เงินสด</label>
ณ สำนักงานสมาคมฯ<br />
<span class="bluetext">กรุณาส่งหลักฐานการชำระเงินพร้อมกับใบสมัครลงทะเบียนประชุมวิชาการ มายังสมาคมฯ โทรสาร :  02-7181488   หรือทาง<br />
E-mail : mfm_th#yahoo.com, por.boon#hotmail.com </span></td>
<td> </td>
</tr>
<tr>
<td colspan="3" valign="top"><span class="redtext"><strong class="yellowhighlight"><em><u>หมายเหตุ</u></em></strong>     </span>
<ol>
<li class="redtext">ลงทะเบียน  Workshop ต้องลงทะเบียนประชุมวิชาการด้วย และเลือกได้ 1  Workshop  เท่านั้น     </li>
<li class="redtext">ผู้สมัครเข้าเป็นสมาชิกใหม่ สามารถลงทะเบียนใช้อัตราสมาชิกได้เลย</li>
<li class="redtext">ผู้ลงทะเบียนหน้างาน อาจไม่ได้รับความสะดวก กระเป๋าและเอกสารประกอบการประชุมอาจไม่ครบถ้วน </li>
<li class="redtext"><strong><u>การยกเลิกการลงทะเบียน</u></strong> ผู้ที่ยกเลิกการลงทะเบียนจะต้องส่งหนังสือขอยกเลิกลงทะเบียนเป็นลายลักษณ์อักษรมายังสมาคมฯ โดยจะได้รับคืนค่าลงทะเบียนภายหลังเสร็จสิ้นงานดังนี้  </li>
</ol>
<p><span class="redtext">ก่อนวันที่  10 เมษายน 2557 คืนร้อยละ 50 ของค่าลงทะเบียน     <br />
หลังวันที่  10 เมษายน 2557 ไม่คืนค่าลงทะเบียน</span><br />
<strong>  </strong><strong><em><u> </u></em></strong><br />
<strong><u>ส่งใบลงทะเบียน, ชำระค่าลงทะเบียน และสอบถามเพิ่มเติมได้ที่</u></strong><strong><u> </u></strong><br />
คุณพรธวัล   บุญชนะทองเลิศ   <br />
สมาคมเวชศาสตร์มารดาและทารกในครรภ์ (ไทย) <br />
อาคารเฉลิมพระบารมี ๕๐ ปี ชั้น 8  เลขที่ 2  ซอยศูนย์วิจัย  ถ.เพชรบุรีตัดใหม่   <br />
แขวงบางกะปิ  เขตห้วยขวาง  กรุงเทพฯ  10310<br />
โทร. 02-7181489     มือถือ  087-6957659      โทรสาร. 02-7181488   <br />
E-mail :  por.boon#hotmail.com  หรือ  mfm_th#yahoo.com <br />
Website :  www.thai-smfm.com</p></td>
</tr>
<tr>
<td colspan="3" valign="top"><img src="images/bottomtext.jpg" width="728" height="359" alt="bottomimage" /></td>
</tr>
<tr>
<td colspan="3" align="center" valign="top"><strong class="bottomtext">ดาวน์โหลดแบบฟอร์มจองที่พักได้ที่  www.thai-smfm.com</strong></td>
</tr>
<tr>
<td colspan="3" align="center" valign="top"><input name="submit" type="submit" class="submit" id="submit" value="Click Here to Register Now" onclick="location.href='http://localhost/registerform/regconfirm.html'"/>
</tr>
</table></td>
<td width="83"><p>
<input type="button" name="clear" value="Clear Form" onclick="clearForm(this.form);">
<input type="hidden" name="MM_insert" value="form" />
</p>
</form>
<
/body>
You can redirect to a html page with php when your code is done with writing to the database. The action tag should direct to the php file where your code handles the form data.
I hope i explained well.
cheers!
Send the form to action= "".
Once the data is saved in database, redirect the form to confirmation page through php.
Syntax for redirect in php :
header('Location:http://yourdomain.com/registerform/regconfirm.html');
exit;
Instead of using "regconfirm.html" create a "regconfirm.php"
Perform your database operation here.
once done regconfirm.php will show confirmation text.
example of form submit would be
< form action ="regconfirm.php" >
// Your Form Here
</form >

Insert a form in a jquery tab to submit data in database using php

I am using a form to submit data in three different tables, it is actually is a simple form with one submit button.
But now I want the form to be divided in three different tabs each having a button, when the page is loaded first tab should be opened with a form having personal details with a proceed button on clicking proceed button second tab should open up containing another part of form and same goes to final tab having a submit button.
I am not getting it how can it be done with php and JQuery tab.
this was the code i wrote
<script type="text/javascript">
function OtherWork(val){
var element=document.getElementById('wtype');
if(val=='other')
element.style.display='block';
else
element.style.display='none';
}
</script>
<h2>Add New Entry</h2>
<hr />
<form action="processnewentry.php" method="post" name="myForm" onsubmit="return validateForm();" >
<table width="560" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="234">Lead Name :</td>
<td width="311"><input type="text" name="lename" /></td>
</tr>
<tr>
<td width="234">Lead Date : (mm/dd/yyyy)</td>
<td width="311"><input type="text" name="ldate" class="datepicker" /></td>
</tr>
<tr>
<td width="234">Contact Person :</td>
<td width="311"><input type="text" name="conper" /></td>
</tr>
<tr>
<td width="234">Company Name :</td>
<td width="311"><input type="text" name="cname" /></td>
</tr>
<tr>
<td width="234">Mobile No. :</td>
<td width="311"><input type="text" name="mobno" /></td>
</tr>
<tr>
<td width="234">Landline No. :</td>
<td width="311"><input type="text" name="phone" /></td>
</tr>
<tr>
<td width="234">Address :</td>
<td width="311"><textarea name="address" ></textarea></td>
</tr>
<tr>
<td width="234">Email :</td>
<td width="311"><input type="text" name="email" /></td>
</tr>
<tr>
<td width="234">Alt Address :</td>
<td width="311"><textarea name="altaddress" ></textarea></td>
</tr>
<tr>
<td width="234">Work Type :</td>
<td width="311"><select name="wtype" onchange='OtherWork(this.value);'>
<option value="Website Designing">Website Designing</option>
<option value="Android Application">Android Application</option>
<option value="other">Other</option>
</select><br />
<input type="text" name="wtype" id="wtype" style='display:none;'/>
</td>
</select>
</tr>
<tr>
<td width="234">Work Description :</td>
<td width="311"><textarea name="wdesc" ></textarea></td>
</tr>
<tr>
<td width="234">Expected Budget :</td>
<td width="311"><input type="text" name="exbudget" /></td>
</tr>
<tr>
<td width="234">Lead Executive :</td>
<td width="311"><select name="lexec">
<?php
$q=mysql_query('SELECT * FROM $table');
while($rr=mysql_fetch_array($q))
{
$na=$rr['name'];
?>
<option value="<?php echo $na;?>"><?php echo strtoupper($na);?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td width="234">Lead Manager :</td>
<td width="311"><select name="lmana">
<?php
$q=mysql_query('SELECT * FROM $table');
while($rr=mysql_fetch_array($q))
{
$na=$rr['name'];
?>
<option value="<?php echo $na;?>"><?php echo strtoupper($na);?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td width="234">Closing Date : (mm/dd/yyyy)</td>
<td width="311"><input type="text" name="cldate" class="datepicker" /></td>
</tr>
<tr>
<td width="234">Lead Status :</td>
<td width="311"><select name="lstat">
<option value="Hot">Hot</option>
<option value="Warm">Warm</option>
<option value="Cold">Cold</option>
</select></td>
</tr>
<tr>
<td width="234">Follow Up :</td>
<td width="311"><textarea name="followup" ></textarea></td>
</tr>
<tr>
<td width="234">Next Follow up : (mm/dd/yyyy)</td>
<td width="311"><input type="text" name="nfoldate" class="datepicker" /></td>
</tr>
<tr>
<td width="234">Remark if any :</td>
<td width="311"><textarea name="remark" ></textarea></td>
</tr>
<tr>
<td width="234"> </td>
<td width="311"><input name="submit" type="submit" value="Submit" class="buttton" /></td>
</tr>
</table>
</form>
your form is having 3 parts(i.ir 3 different tabs).So give 3 different html classes to its fields.Eg.
fields on first tab will look like :
fields on first tab will look like :
fields on first tab will look like :
At first, fields on second and third tab would be display none.
Now on click of first proceed button, validate fields(if required) and then, make fields on first tab display none using jquery(i.e. add css property)
Eg.
$("#first_proceed").click(function(){
$(".first").css("display","none");
})
Same for second proceed button.
And on click of third button(i.e. submit), Submit your form

Categories