Having issue in my application form download - php

Having issue in my application form download.My issue is.once the form is submitted my java script code is not submitting the form to another page.page name is app_print.php.I have implemented js code in php.once every thing is correct.the app_print.php goes to download section.I have hosted in my webserver. Here is the link. http://lisieuxcbsekovai.com/application.php
Here is my code:
application.php
<form action="" method="post" name="application">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td colspan="3">
<?php
if(isset($_POST['application']))
{
unset($_POST['application']);
if(isset($rep))
{
if($rep=='sus')
{
?>
<div class="sus cl"><img class="pa" src="controller/image/btn/tick_circle.png"/><?php echo $msg;?><a style="margin:0px 0px 0px 0px;" href="javascript:void(0);"><img id="close" src="controller/image/btn/cross_grey_small.png"/></a></div>
<?php
}
else if($rep=='fld')
{
?>
<div class="error cl"><img class="pa" src="controller/image/btn/cross_circle.png"/><?php echo $msg;?><img id="close" src="controller/image/btn/cross_grey_small.png"/></div>
<?php
}
else if($rep=='atn')
{
?>
<div class="atn cl"><img class="pa" src="controller/image/btn/exclamation.png"/><?php echo $msg;?><img id="close" src="controller/image/btn/cross_grey_small.png"/></div>
<?php
}
}
}
?>
</td>
</tr>
<tr>
<th class="lft_col" colspan="3" style="color:#DB0009">APPLICATION FORM</th>
</tr>
<tr>
<td class="red">1.</td>
<th class="lft_col"><label>Name of the child<span class="red">*</span><br/><span style="font-size:11px;">(In Block letter)</span></label></th>
<td><input class="text" type="text" name="name" placeholder="Enter your Name" required value=""/></td>
</tr>
<tr>
<td class="red">2.</td>
<th class="lft_col"><label>Sex</label><span class="red">*</span></th>
<td>
<select class="select_2" name="sex" required>
<option value="">---Select---</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td class="red">3.</td>
<th class="lft_col"><label>Name of Parents<span class="red">*</span></label></th>
<td>
<table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="red">i.</td>
<th class="lft_col">Father Name</th>
<td><input class="text" type="text" name="father" placeholder="Your Father/Guardian Name" required value=""/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="red">ii.</td>
<th class="lft_col">Mother Name</th>
<td><input class="text" type="text" name="mother" placeholder="Your Mother Name" required value=""/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="red">4.</td>
<th class="lft_col"><label>Address for <br/>communication<span class="red">*</span><label></th>
<td><textarea class="text" rows="10" placeholder="Your Communication Address." required name="address"></textarea></td>
</tr>
<tr>
<td class="red">5.</td>
<th class="lft_col">Contact No<span class="red">*</span></th>
<td><input class="text" type="text" name="mobile" placeholder="Mobile:+91 999999999" required value=""/></td>
</tr>
<tr>
<td class="red">6.</td>
<th class="lft_col"><label>Occupation of <br/>Parents with details<span class="red">*</span></label></th>
<td>
<table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="red">i.</td>
<th class="lft_col"><label>Father Occupation</label></th>
<td><input class="text" type="text" name="father_occ" placeholder="Your Father/Guardian Occupation details" required value=""/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="red">ii.</td>
<th class="lft_col"><label>Mother Occupation</label></th>
<td><input class="text" type="text" name="mother_occ" placeholder="Your Mother Occupation details" required value=""/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="red">7.</td>
<th class="lft_col"><label>Date of Birth<span class="red">*</span><br/><span style="font-size:11px;">(as per Birth certificate)</span></label></th>
<td><input class="text" type="date" name="dob" placeholder="Your Date of Birth" required value=""/></td>
</tr>
<tr>
<td class="red">8.</td>
<th class="lft_col"><label>No of Year & Months that will <br/>be Completed as on June 1st<span class="red">*</span></label></th>
<td><input class="text" type="text" name="age" placeholder="Your Age (YYYY/MM/DD)" required value=""/></td>
</tr>
<tr>
<td class="red">9.</td>
<th class="lft_col"><label>Religion & Caste<span class="red">*</span><br/><span style="font-size:11px;">for Statistical purpose only</span></label></th>
<td><input class="text" type="text" name="religion" placeholder="Your Religion & Caste" required value=""/></td>
</tr>
<tr>
<td colspan="2"> </td>
<td class="lft_col">
<input class="btn" type="submit" name="application" value="Submit"/>
<input class="btn" onClick="javascript:window.location='application.php'" type="button" name="Cancel" value="Cancel"/>
</td>
</tr>
</table>
</form>
application.php
if(isset($_POST['application']))
{
$name=$_POST['name'];
$sex=$_POST['sex'];
$father=$_POST['father'];
$mother=$_POST['mother'];
$address=$_POST['address'];
$mobile=$_POST['mobile'];
$father_occ=$_POST['father_occ'];
$mother_occ=$_POST['mother_occ'];
$dob=$_POST['dob'];
$age=$_POST['age'];
$religion=$_POST['religion'];
date_default_timezone_set('Asia/Kolkata');
$cur_date = date('m/d/Y h:i:s a', time());
if($name!=''&&$sex!=''&&$father!=''&&$mother!=''&&$address!=''&&$mobile!=''&&$father_occ!=''&&$mother_occ!=''&&$dob!=''&&$age!=''&&$religion!='')
{
$con_qry=mysql_query("insert into application (name,sex,father,mother,address,mobile,father_occ,mother_occ,dob,age,religion,cur_date) values('".$name."','".$sex."','".$father."','".$mother."','".$address."','".$mobile."','".$father_occ."','".$mother_occ."','".$dob."','".$age."','".$religion."','".$cur_date."')");
if($con_qry)
{
$rep="sus";
$msg='Your application is downloaded, you can print the application from your download path.';
echo "<script type='text/javascript'>var url='app_print.php?id=$cur_date&c_name=$name';window.open(url)</script>";
}
else
{
$rep="fld";
$msg='Registeration Faild.';
}
}
}
?>
my app_print.php:
if((isset($_GET['id']))&&(isset($_GET['c_name'])))
{
$print=mysql_query("select * from application where name='".$_GET['c_name']."' and cur_date='".$_GET['id']."'");
$p_r=mysql_num_rows($print);
if($p_r>0)
{
$print_val=mysql_fetch_array($print);
$aid=$print_val['aid'];
$name=$print_val['name'];
$sex=$print_val['sex'];
$father=$print_val['father'];
$mother=$print_val['mother'];
$address=$print_val['address'];
$mobile=$print_val['mobile'];
$father_occ=$print_val['father_occ'];
$mother_occ=$print_val['mother_occ'];
$dob=$print_val['dob'];
$age=$print_val['age'];
$religion=$print_val['religion'];
$cur_date =$print_val['cur_date'];
header("Content-Type: application/download");
header("Content-Type: application/msword");
header('content-Disposition: attachment; filename='.$name.' Application'.'.doc');
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>LISIEUX - APPLICATION FORM</title>
</head>
<body>
<form action="" method="post" name="app_print">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td colspan="3" style="text-align:center;"><label><b style="font-size:29px;">Lisieux CMI Public School</b></label><br/><label>(CBSE Syllabus)</label><br/><label>Lisieux Road,Saravanampatti,Viswasapuram,Coimbatore - 641035.</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td style="border-top:1px solid #000000;"> </td>
<td style="border-top:1px solid #000000;"> </td>
<td style="border-top:1px solid #000000;"> </td>
</tr>
<tr>
<th colspan="3" style="text-align:center;">REGISTRATION FORM</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td style="text-align:right;"><label>Reg.No. : <?php if(isset($aid)){echo $aid;}?></label></td>
</tr>
<tr>
<td>1.</td>
<th><label>Name of the child<br/><span style="font-size:16px;">(In Block letter)</span></label></th>
<td><label><?php if(isset($name)){echo $name;}?></label></td>
</tr>
<tr>
<td>2.</td>
<th><label>Sex</label></th>
<td><label><?php if(isset($sex)){echo $sex;}?></label></td>
</tr>
<tr>
<td>3.</td>
<th><label>Name of Parents</label></th>
<td>
<table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>i.</td>
<th><label>Father : </label></th>
<td><label><?php if(isset($father)){echo $father;}?></label></td>
</tr>
<tr>
<td>ii.</td>
<th><label>Mother : </label></th>
<td><label><?php if(isset($mother)){echo $mother;}?></label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>4.</td>
<th><label>Address for <br/>communication</label></th>
<td><label><?php if(isset($address)){echo $address;}?></label></td>
</tr>
<tr>
<td>5.</td>
<th>Contact No</th>
<td><label><?php if(isset($mobile)){echo $mobile;}?></label></td>
</tr>
<tr>
<td>6.</td>
<th><label>Occupation of <br/>Parents with details</label></th>
<td>
<table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>i.</td>
<th><label>Father : </label></th>
<td><label><?php if(isset($father_occ)){echo $father_occ;}?></label></td>
</tr>
<tr>
<td>ii.</td>
<th><label>Mother : </label></th>
<td><label><?php if(isset($mother_occ)){echo $mother_occ;}?></label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>7.</td>
<th><label>Date of Birth<br/><span style="font-size:16px;">(as per Birth certificate)</span></label></th>
<td><label><?php if(isset($dob)){echo $dob;}?></label></td>
</tr>
<tr>
<td>8.</td>
<th><label>No of Year & Months that will be<br/>Completed as on June 1st</label></th>
<td><label><?php if(isset($age)){echo $age;}?></label></td>
</tr>
<tr>
<td>9.</td>
<th><label>Religion & Caste<br/><span style="font-size:16px;">for Statistical purpose only</span></label></th>
<td><label><?php if(isset($religion)){echo $religion;}?></label></td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><label>Date : <?php if(isset($cur_date)){echo $cur_date;}?></label></td>
<td style="text-align:right;">Signature of Parent/Guardian</td>
</tr>
</table>
</td>
</tr>
</table>
</form>

window.open does (surprise) open a new browser window. Are you sure there is no pop-up blocker active in your browser? Otherwise you might miss the popup. You can debug Javascript with the F12 debugging tools in all major browsers. Set a breakpoint to the window.open line and see if the line is called. Some pop-up blockers also log to the console also available via F12

window.open() unfortunately has a way of getting 'blocked' by most browsers as an 'unwanted' pop-up if used during a page load - it is probably advisable to use a different way of calling the window.open() statement. An alternative way to accomplish what you are attempting (and side stepping popup blockers) is to consider changing your statement in app_print.php:
echo "<script type='text/javascript'>var url='app_print.php?id=$cur_date&c_name=$name';window.open(url)</script>";
to something like:
echo "<script type='text/javascript'>window.onload=function () { window.location='/app_print.php?id=$cur_date&c_name=$name' }; </script>";
and thus not using window.open() at all.

Related

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

Using PHP and Forms to Manipulate Data

I am new to php and I am having a hard time finding a good tutorial on how to do what I want to do. I know I want to have the feature to be able to add three variables and put the result into a textbox on the same page. Here is the code I have. I am getting an error when trying to display the result into a textbox. Any help appreciated.
<html>
<head>
<title>Field of View Calculator</title>
</head>
<body>
<form method="post" action="Test_Calculator.php" enctype="multipart/form-data">
<table width="1000" align="center" border="10">
<tr>
<td align="center" bgcolor="khaki" colspan="6"><h1>Field of View</h1></td>
</tr>
<tr>
<td align="center" colspan="1">Input</td>
<td align="center"" colspan="1">Intermediate Variables</td>
<td align="center" colspan="1">Output</td>
</tr>
<tr>
<td align="right" colspan="1">Number of Rings:</td>
<td><input type="text" name="rings" size="40"></td>
<td><input type="text" value="<?php echo $result; ?>" /></td>
<td align="right">Number of Rings:</td>
</tr>
<tr>
<td align="right">Wavelength:</td>
<td><input type="text" name="wave" size="40"></td>
</tr>
<tr>
<td align="right">Emitter Space:</td>
<td><input type="text" name="emitter" size="40"></td>
</tr>
<tr>
<td align="right">Static Values:</td>
<td align="center" colspan="6"><textarea name="content" cols="115" rows="15"></textarea></td>
</tr>
<tr>
<td align="center" colspan="6"><input type="submit" name="submit" value="Publish Now"></td>
</tr>
</form>
</body>
</html>
<?php
$result = 1 * 764000;
?>
You have to assign a value to $result before you try to echo it out.
Move the last 5 lines to the top of the file.

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

Multiple checkbox to a sentence before insert to mysql

I' edit this question with my full coding
Let me post my full code here.
Page1.php
<div id="container">
<div class="box">
<form name="form" method="post" action="userbooking2.php">
<table width="" style="border: 0px solid black" align="center">
<tr>
<td><h2>Book a Room Step 1 - Booking Information</h2></td>
</tr>
<tr>
<td>
<table>
<tr>
<td width="150px" class="titlestyle">Booked by</td>
<td width="400px"><span style="text-transform: uppercase;"><?php echo $_SESSION['SESS_FNAME']; ?></span></td>
</tr>
<tr>
<td class="titlestyle">Title</td>
<td><span class="hint--right" data-hint="Hint : Organization meeting"><input type="text" name="booking_title" id="booking_title" maxlength="50" size="50" /></span></td>
</tr>
<tr>
<td class="titlestyle">Date</td>
<td>From <input type="text" name="booking_start_date" id="booking_start_date"/> to <input type="text" name="booking_end_date" id="booking_end_date"/></td>
</tr>
<tr>
<td class="titlestyle">Time</td>
<td>From <input name="booking_start_time" id="booking_start_time" value="8:00 AM" /> to <input name="booking_end_time" id="booking_end_time" value="8:30 AM"/></td>
</tr>
<tr>
<td class="titlestyle">Room</td>
<td><select name="room_type" id="room_type">
<option value="none">--Select--</option>
<option value="Meeting Room">Meeting Room</option>
<option value="Lecture Room">Lecture Room</option>
<option value="Computer Lab">Computer Lab</option>
</select>
</td>
</tr>
<tr>
<td class="titlestyle">Participant</td>
<td><span class="hint--right" data-hint="Hint : Insert number of participants"><input type="text" name="room_participant" id="room_participant" maxlength="50" size="3" /></span> Persons</td>
</tr>
<tr>
<td class="titlestyle">Equipment</td>
<td><table>
<tr>
<td><input type="checkbox" name="room_facility[]" value="Audio System" />Audio System</td>
<td><input type="checkbox" name="room_facility[]" value="Projector" />Projector</td>
<td><input type="checkbox" name="room_facility[]" value="Video Conferencing" />Video Conferencing</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="titlestyle">Food & Baverages</td>
<td><table>
<tr>
<td><input type="checkbox" name="room_food[]" value="Breakfast" />Breakfast</td>
<td><input type="checkbox" name="room_food[]" value="Tea Break" />Tea Break</td>
<td><input type="checkbox" name="room_food[]" value="Lunch" />Lunch</td>
</tr>
<tr>
<td><input type="checkbox" name="room_food[]" value="High Tea" />High Tea</td>
<td><input type="checkbox" name="room_food[]" value="Dinner" />Dinner</td>
<td><input type="checkbox" name="room_food[]" value="No" />No, thanks</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="titlestyle">Additional Info</td>
<td><span class="hint--right" data-hint="Hint : ."><textarea name="booking_desc" id="booking_desc" style="max-width:400px;" rows="4" cols="50"></textarea></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="Submit" value="Next" /></td>
</tr>
</table>
</form>
</div>
Page2.php
<?php
//now, let's register our session variables
session_register('fname');
session_register('booking_title');
session_register('booking_start_date');
session_register('booking_end_date');
session_register('booking_start_time');
session_register('booking_end_time');
session_register('room_participant');
session_register('room_type');
session_register('booking_facility');
session_register('booking_food');
session_register('booking_desc');
//finally, let's store our posted values in the session variables
$_SESSION['fname'] = $_SESSION['SESS_FNAME'];
$_SESSION['booking_title'] = $_POST['booking_title'];
$_SESSION['booking_start_date'] = $_POST['booking_start_date'];
$_SESSION['booking_end_date'] = $_POST['booking_end_date'];
$_SESSION['booking_start_time'] = $_POST['booking_start_time'];
$_SESSION['booking_end_time'] = $_POST['booking_end_time'];
$_SESSION['room_participant'] = $_POST['room_participant'];
$_SESSION['room_type'] = $_POST['room_type'];
$_SESSION['room_facility'] = /* WHAT TO SEND HERE? */
$_SESSION['room_food'] = $_POST['room_food'];
$_SESSION['booking_desc'] = $_POST['booking_desc'];?>
// Other form process here
Page3.php
<div id="container">
<div class="box">
<form name="form" method="post" action="">
<table width="" style="border: 0px solid black" align="center">
<tr>
<td><h2>Book a Room Step 3 - Final</h2></td>
</tr>
<tr>
<td>
<table>
<tr>
<td width="150px" class="titlestyle">Booked by</td>
<td width="400px" ><span style="text-transform: uppercase;"><?php echo $_SESSION['SESS_FNAME']; ?></span></td>
</tr>
<tr>
<td class="titlestyle">Title</td>
<td><?php echo $_SESSION['booking_title']; ?></td>
</tr>
<tr>
<td class="titlestyle">Date</td>
<td>From <?php echo $_SESSION['booking_start_date']; ?> to <?php echo $_SESSION['booking_end_date']; ?></td>
</tr>
<tr>
<td class="titlestyle">Time</td>
<td>From <?php echo $_SESSION['booking_start_time']; ?> to <?php echo $_SESSION['booking_end_time']; ?></td>
</tr>
<tr>
<td class="titlestyle">Room</td>
<td><?php echo $_SESSION['room_name']; ?></td>
</tr>
<tr>
<td class="titlestyle">Participant</td>
<td><?php echo $_SESSION['room_participant']; ?> Persons</td>
</tr>
<tr>
<td class="titlestyle">Equipment</td>
<td><?php echo $_SESSION['room_facility']; ?></td>
</tr>
<tr>
<td class="titlestyle">Food & Baverages</td>
<td><?php echo $_SESSION['room_food']; ?></td>
</tr>
<tr>
<td class="titlestyle">Additional Info</td>
<td><?php echo $_SESSION['booking_desc']; ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
</div>
In page3.php, i want to view this kind of string "I book Value1, Value2" before store it into the database
Use:
$string = implode(', ', isset($_REQUEST['room_facility']) ? $_REQUEST['room_facility'] : array());
echo 'I need ' . $string;
Then just insert into the database as normal

Categories