472,126 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

searching record given the form

<?php
session_start();
error_reporting(E_ERROR && ~E_NOTICE && ~E_WARNING);
ob_start();
$link = mysql_connect('localhost', 'root', 'test');
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
if (isset($_POST["Submit"]))
{
$deptfrom= "'".$_POST['depfrom']."'";
$arrfrom = "'".$_POST['arrfrom']."'";
$dept = "'".$_POST['dept']."'";
$depto = "'".$_POST['depto']."'";
$arrto = "'".$_POST['arrto']."'";
$grant = "'".$_POST['grant']."'";
$depdate ="'".$_POST['depdate']."'";
$arrdate ="'".$_POST['arrdate']."'";
trim($depdate);
trim(arrdate);
if(!$deptfrom || !$arrfrom || !$dept || !$depto || !$arrto || !$grant || !$depdate || !$arrdate)
{
echo "you have some empty fields";
}

switch($_POST["Submit"])
{
case 'Submit':
{
//$str_query = "INSERT INTO book(depfrom,arrfrom,dept,depto,arrto,grant,depdat e,arrdate) VALUES($depfrom,$arrfrom,$dept,$depto,$arrto,$gran t,$depdate,$arrdate)";
$str_query = "INSERT INTO book(depfrom,arrfrom,dept,depto,arrto,granter,depd ate,arrdate) VALUES($deptfrom,$arrfrom,$dept,$depto,$arrto,$gra nt,$depdate,$arrdate)";
$mysql_access = mysql_pconnect("localhost", "root", "test");
if (!$mysql_access)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("flight");


break;
}

}

}
$result = mysql_query($str_query, $mysql_access);
$numof_rows=mysql_num_rows($result);
if($numof_rows==1)
if($_POST['Submit']=="search")

//search id
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Flight Booking System</title>
<style>
a, A:link, a:visited, a:active
{color: #0000aa; text-decoration: none; font-family: Tahoma, Verdana; font-size: 12px}
A:hover
{color: #ff0000; text-decoration: none; font-family: Tahoma, Verdana; font-size: 12px}
p, tr, td, ul, li
{color: #000000; font-family: Tahoma, Verdana; font-size: 11px}
th
{background: #DBEAF5; color: #000000;}
.header1, h1
{color: #ffffff; background: #4682B4; font-weight: bold; font-family: Tahoma, Verdana; font-size: 14px; margin: 0px; padding-left: 2px; height: 21px}
.header2, h2
{color: #000000; background: #DBEAF5; font-weight: bold; font-family: Tahoma, Verdana; font-size: 12px;}
.intd
{color: #000000; font-family: Tahoma, Verdana; font-size: 11px; padding-left: 15px;}
.wcell
{background: #FFFFFF; vertical-align: top}
.ctrl
{font-family: Tahoma, Verdana, sans-serif; font-size: 12px; width: 100%;}
.btnform
{border: 0px; font-family: tahoma, verdana; font-size: 12px; background-color: #DBEAF5; width: 100%; height:18px; text-align: center; cursor: hand;}
.btn
{background-color: #DBEAF5; padding: 0px;}
textarea, select,input
{font: 9px Verdana, arial, helvetica, sans-serif; background-color: #DBEAF5;}

/* classes for validator */
.tfvHighlight
{font-weight: bold; color: red;}
.tfvNormal
{font-weight: normal; color: black;}
.copysmall { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #3B3B3B; font-size: 12px; margin-top:3px; margin-bottom:11px; margin-left:0px; margin-right:0px }
.copy { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #3B3B3B; font-size: 13px; margin-top:3px; margin-bottom:11px; margin-left:0px; margin-right:0px }
.copymed { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #3B3B3B; font-size: 14px; margin-top:3px; margin-bottom:11px; margin-left:0px; margin-right:0px }
.copylarge { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #3B3B3B; font-size: 15px; margin-top:3px; margin-bottom:11px; margin-left:0px; margin-right:0px }
.copymedred { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #FF0000; font-size: 14px; margin-top:3px; margin-bottom:11px; margin-left:0px; margin-right:0px }
.copyheader { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #2778CB; font-size: 14px; margin-top:3px; margin-bottom:0px; margin-left:0px; margin-right:0px }
.copyheaderwhite { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 14px; margin-top:3px; margin-bottom:0px; margin-left:0px; margin-right:0px }
.header7, h7 { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #2778CB; font-size: 15px; font-weight: bold }
.copysmalltitle { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #2778CB; font-size: 15px; font-weight: bold }
.copysubtitle { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #2778CB; font-size: 15px }
.copyfooter { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #000000; font-size: 13px }
.copydownload { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #3B3B3B; font-size: 13px }

p { font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; color: #2778CB; font-size: 15px; font-weight: bold }
p.topmarg { margin-top:12px; margin-bottom:8px; }
p.nobot { margin-top:2px; margin-bottom:0px; }
p.topmargnobot { margin-top:12px; margin-bottom:0px; }
p.nav { color:#FFFFFF; text-align:center; margin-top:8px; margin-bottom:12px; margin-left:3px; margin-right:3px; }
p.foot { font-size:9px; margin-top:3px; margin-bottom:3px; margin-left:3px; margin-right:3px; }

a { color: #003366; text-decoration: none }
a:hover { text-decoration: underline }
a:visited { color: #446185; text-decoration: none }
a:visited:hover { text-decoration: underline }

.copywhite { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 12px }
.copywhiteB { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 12px; font-weight: bold }

/*More Information Link Style */
.copy11 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px }

/* Section Headers Style */
.blueheader { font-family: Verdana, Arial, Helvetica, sans-serif; color: #446185; font-size: 13px; font-weight: bold }
.whiteheader { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 13px; font-weight: bold }

.topics { font-family: Verdana, Arial, Helvetica, sans-serif; color: #CCCCCC; font-size: 11px }
.topicsB { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 11px; font-weight: bold }
.topicsH { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 11px}

h2 { font-size:13px; color:#2778CB; margin-left:0px; margin-right:0px; margin-top:3px; margin-bottom:0px; }
.listitem {
line-height: 15px;
font-size: 11px;
font-family: Verdana, Tahoma, Arial, Helvetica;
font-weight: normal;
color: #262626;
margin-top:4px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px
}

.subtitle_body{
background-image: url(images/subtitle_body.gif);
background-repeat: repeat-x;
color: #035AA4;
font-size: 13px;
font-weight: bold;
}

.subtitle_cap{
height: 25px;
width: 12px;
background : url(images/subtitle_cap.gif);
}
.style6 {font-size: 12px}
</style>
</head>

<body>
<fieldset>
<a href="flight.php"> Home </a> | <a href=grants.php> Add Grant </a> | Log Out | <a href="List.php">List</a>|
</fieldset><br><script language="JavaScript" src="validator.js"></script>

<script language="JavaScript" src="calendar1.js"></script><!-- -->


<form action="flight.php" method="POST" name="flight" enctype="multipart/form-data" id="form_uploader" onsubmit="return v.exec()">
<table cellpadding="0" cellspacing="0" border="0" width="80%" align="center">
<tr>
<td bgcolor="#4682B4" width="10"><img src="img/pixel.gif" width="10" height="1" border="0"></td>
<td class="header1" nowrap> Flight Booking </td>
<td><img src="img/formtab_r.gif" width="10" height="21" border="0"></td>
<td background="img/line_t.gif" width="100%"> <img src="img/pixel.gif" width="10" height="1" border="0"></td>
</tr>
<tr>
<td background="img/line_l.gif"><img src="img/pixel.gif" border="0"></td>
<td colspan="3">
<img src="img/pixel.gif" width="1" height="10" border="0"><br>
<div align="center"
id="Error_Departments" style="display: block;"></div>
<table cellpadding="0" cellspacing="0" border="0" width="100%" bordercolor='#111111'><tr><td bgcolor="#DBEAF5">
<table cellspacing="1" cellpadding="3" border="0" width="100%">
<tr bgcolor="#ffffff">

<td colspan="11" nowrap="nowrap" id="t_pvisit"><div align="right"></div></td>
</tr>
<tr bgcolor="#ffffff">
<td width="94" nowrap="nowrap" id="t_vtitle"><div align="right">Departure From</div></td>
<td width="142" valign=top><input name="depfrom" value = "<?php print($row->depfrom);?>" type="text" class="ctrl" id="depfrom" size="20" /></td>
<td width="27" valign=top> <div align="right">To </div></td>
<td width="134" valign=top><input name="depto" value = "<?php print($row->depto);?>" type="text" class="ctrl" id="depto" size="20" /></td>

<td width="86" valign=top><div align="right">Departure Date/Time</div></td>
<td width="124"><input name="depdate"value = "<?php print($row->depdate);?>" type="text" class="ctrl" id="depdate" /></td>
<td width="19"><a href="javascript:cal1.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"/></a></td>
</tr>
<tr bgcolor="#ffffff">
<td nowrap="nowrap" id="t_vtitle"><div align="right">Arrival From </div></td>
<td valign=top><input name="arrfrom" value = "<?php print($row->arrfrom);?>" type="text" class="ctrl" id="arrfrom" size="20" /></td>
<td valign=top><div align="right">To</div></td>

<td valign=top><input name="arrto" value = "<?php print($row->arrto);?>" type="text" class="ctrl" id="arrto" size="20" /></td>
<td valign=top><div align="right">Arrival Date/Time</div></td>
<td><input name="arrdate"value = "<?php print($row->arrdate);?>" type="text" class="ctrl" id="arrdate" /></td>
<td><a href="javascript:cal2.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"/></a></td>
</tr>
<tr bgcolor="#ffffff">
<td nowrap="nowrap" id="t_dfrom"><div align="right">Cost Center </div></td>
<td valign=top><select name="dept" class="ctrl" >

<option value="">-- select --
<option value="54">ABD
<option value="36">ADMIN-CGMRC
<option value=27 <?php if($row->dept=="ADMIN-SA") echo "selected";?> >ADMIN-SA<option value=13 <?php if($row->dept=="ADMINISTRATION") echo "selected";?> >ADMINISTRATION<option value=24 <?php if($row->dept=="AED-CPT") echo "selected";?> >AED-CPT<option value=29 <?php if($row->dept=="ASF") echo "selected";?> >ASF<option value=59 <?php if($row->dept=="ASSESMENT") echo "selected";?> >ASSESSMENT<option value=61 <?php if($row->dept=="BUF") echo "selected";?> >BUF<option value=50 <?php if($row->dept=="CDA") echo "selected";?> >CDA<option value=51 <?php if($row->dept=="CDA-PINGILIKANI") echo "selected";?> >CDA-PINGILIKANI<option value=53 <?php if($row->dept=="CLINICAL-KEMRI") echo "selected";?> >CLINICAL-KEMRI<option value=12 <?php if($row->dept=="CLINICAL-WDI") echo "selected";?>>CLINICAL-WD1<option value=32 <?php if($row->dept=="CNF") echo "selected";?> >CNF<option value=47 <?php if($row->dept=="CTL-CHEMISTRY") echo "selected";?> >CTL-CHEMISTRY<option value=40 <?php if($row->dept=="CTL-haematology") echo "selected";?> >CTL-haematology<option value=58 <?php if($row->dept=="DSS") echo "selected";?> >DSS<option value=11 <?php if($row->dept=="ENTOMOLOGY") echo "selected";?> >ENTOMOLOGY<option value=31 <?php if($row->dept=="FOF") echo "selected";?> >FOF<option value=60 <?php if($row->dept=="GARAGE") echo "selected";?> >GARAGE<option value=46 <?php if($row->dept=="HELMINTH STUDY") echo "selected";?> >HELMINTH STUDY<option value=49 <?php if($row->dept=="IAVI LABS-MTWAPA") echo "selected";?> >IAVI LABS-MTWAPA<option value=17 <?php if($row->dept=="IAVI-CHC") echo "selected";?> >IAVI-CHC<option value=42 <?php if($row->dept=="IAVI-LABS") echo "selected";?> >IAVI-LABS<option value=23 <?php if($row->dept=="ICIPE") echo "selected";?> >ICIPE<option value=6 <?php if($row->dept=="ICT") echo "selected";?> >ICT<option value=43 <?php if($row->dept=="IMM-LUCY") echo "selected";?> >IMM-LUCY<option value=44 <?php if($row->dept=="IMMUNOLOGY") echo "selected";?> >IMMUNOLOGY<option value=25 <?php if($row->dept=="JBKF") echo "selected";?> >JBKF<option value=18 <?php if($row->dept=="JNF") echo "selected";?> >JNF<option value=34 <?php if($row->dept=="JNF") echo "selected";?> >JNF<option value=55 <?php if($row->dept=="KDH-admin") echo "selected";?> >KDH-admin<option value=56 <?php if($row->dept=="KDH-OPD") echo "selected";?> >KDH-OPD<option value=57 <?php if($row->dept=="KDH-WARDS") echo "selected";?> >KDH-WARDS<option value=37 <?php if($row->dept=="KMF") echo "selected";?> >KMF<option value=10 <?php if($row->dept=="LABS") echo "selected";?> >LABS<option value=38 <?php if($row->dept=="MICRO-LAB") echo "selected";?> >MICRO-LAB<option value=33 <?php if($row->dept=="MMF") echo "selected";?> >MMF<option value=21 <?php if($row->dept=="MVI") echo "selected";?> >MVI<option value=28 <?php if($row->dept=="OHF") echo "selected";?> >OHF<option value=26 <?php if($row->dept=="PBF") echo "selected";?> >PBF<option value=45 <?php if($row->dept=="PBJ-F") echo "selected";?> >PBJ-F<option value=41 <?php if($row->dept=="RSV-LAB") echo "selected";?> >RSV-LAB<option value=52 <?php if($row->dept=="RTSS") echo "selected";?> >RTSS<option value=16 <?php if($row->dept=="SBR") echo "selected";?> >SBR<option value=20 <?php if($row->dept=="SMF2") echo "selected";?> >SMF2<option value=39 <?php if($row->dept=="TOP LAB") echo "selected";?> >TOP LAB<option value=35 <?php if($row->dept=="TRAINING") echo "selected";?> >TRAINING<option value=19 <?php if($row->dept=="twill-LABS") echo "selected";?> >twill-LABS<option value=48 <?php if($row->dept=="Twill-MalariaGen") echo "selected";?> >Twill-MalariaGen
</select></td>

<td valign=top id="t_dateto"><div align="right">Grant</div></td>
<td valign=top><select name="grant" class="ctrl" >
<option value="">-- select --
<option value="ASF">ASF
<option value="KMF">KMF
<option value="OXMAL">OXMAL
</select></td>
<td valign=top>&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>

<tr bgcolor="#ffffff">
<td id="t_paccom">&nbsp;</td>
<td colspan="4" bgcolor="#ffffff"><input type="hidden" name="action" value=add />
<input type="hidden" name="flightid" />
</td><td colspan="2">
<div align="left"> <input name="form_submit" type="hidden" id="form_submit" value="form_uploader"> </div></td></tr>
</table></td>
</tr></table>

<img src="img/pixel.gif" width="1" height="10" border="0"><br>
</td>
<td background="img/line_r.gif"><img src="img/pixel.gif" border="0"></td>
</tr>
<tr>
<td width="10"><img src="img/formtab_b.gif" width="10" height="20" border="0"></td>
<td bgcolor="#4682B4" colspan="4" align="right">
<table cellpadding="0" cellspacing="0" border="0">
<tr>

<td class="btn" width="100"><input type="reset" name="Reset" value="Reset" class="btnform"></td>
<td width="1"><img src="img/pixel.gif" width="1" height="18" border="0"></td>
<td class="btn" width="100"><input type="submit" name="Submit" value="Submit" class="btnform"></td>
<td width="1"><img src="img/pixel.gif" width="1" height="18" border="0"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<p></p><p></p>


<?php
echo "<div align=center>";
if(isset($_POST['Submit']))
{
mysql_pconnect("localhost", "root", "test");
mysql_select_db("flight");
$result = mysql_query("select * from book");
$num_rows=mysql_num_rows($result);

echo "<table border=1 rules=all width=99% cellspacing=1 cellpadding=2 bordercolor=#663333><tr bgcolor=#e8e8e8><th scope=col>Depfrom</th>
<th>Arrfrom</th><th>Dept</th><th>Depto</th><th>Arrto</th><th>Grant</th><th>Depdate</th><th>Arrdate</th>";

for($index=0;$index<$num_rows;$index++)
{
$rows=mysql_fetch_array($result);
echo '<tr>
<td>&nbsp;';
echo $rows[depfrom];
echo'</td> <td>&nbsp;';
echo htmlspecialchars(stripslashes($rows[arrfrom]));
echo '</td> <td>&nbsp;';
echo htmlspecialchars(stripslashes($rows[dept]));
echo '</td> <td>&nbsp; ';
echo htmlspecialchars(stripslashes($rows[depto]));
echo '</td> <td>&nbsp; ';
echo htmlspecialchars(stripslashes($rows[arrto]));
echo '</td> <td>&nbsp;';
echo htmlspecialchars(stripslashes($rows[granter]));
echo '</td> <td>&nbsp;';
echo htmlspecialchars(stripslashes($rows[depdate]));
echo '</td> <td>&nbsp; ';
echo htmlspecialchars(stripslashes($rows[arrdate]));
echo '</td> </tr>';
}
echo '</table><p>';

}
echo "</div";
?>

<br><br><fieldset><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<table cellpadding=3 cellspacing=0 width=100% border=0 height=22>
<tr bgcolor=#4682B4>
<td nowrap><font color=white>Copyright &copy;2007 ICT. All rights reserved. KILIFI intranet Version 1.0.1</font><font size=1 color=white> <div align=right>Recommended Browsers: Mozilla FireFox/Internet Explorer</div></font></td>
<td align=right>&nbsp;

</td>
</tr>
</table>
</body>
</html>
</fieldset><script language="JavaScript">
<!--
var cal1 = new calendar1(document.forms['flight'].elements['depdate']);
cal1.year_scroll = true;
cal1.time_comp = true;
var cal2 = new calendar1(document.forms['flight'].elements['arrdate']);
cal2.year_scroll = true;
cal2.time_comp = true;
//-->
</script>
<script>
var a_fields = {
'grant': {
'l': 'grant description', // label
'r': true, // required
't': 't_grant', // id of the element to highlight if input not validated

'm': null, // must match specified form field
'mn': 2, // minimum length
'mx': 100 // maximum length
}

},

o_config = {
'to_disable' : ['Submit'],
'alert' : 1
}

// validator constructor call
var v = new validator('frmgrants', a_fields, o_config);

</script>

</body>
Aug 2 '07 #1
1 1659
mwasif
802 Expert 512MB
Explain what you want to do.

Kindly use code tags when posting your source code. To know how to use appropriate code tags look at Posting Guidelines.
Aug 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Michi | last post: by
8 posts views Thread by David | last post: by
3 posts views Thread by Simone | last post: by
3 posts views Thread by Michiel Rapati-Kekkonen | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.