Messed up HTML/CSS design [closed] - php

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm just checking other people's works and Im fixing this design and I can't seem to have an idea on how to fix it. I don't want to change anything from the css so is it possible to just arrange it on html?
<!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=iso-8859-1" />
<title>Clinical Module</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<body>
<form action='' method='POST'><center>
<input type="text" placeholder="Patient Number" name="search" > <input type="submit" Value="Check" name='submit'> <br>
<?php
mysql_connect("localhost","root","");
mysql_select_db("invoices");
$search = 0;
$search=$_POST['search'];
if (isset($_POST['submit'])){
$query = "select * from `patient` where `clientid` = $search ";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ?>
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
</td>
</tr>
<tr>
<td valign="top" align="right">
Middle name:</td>
<td valign="top" align="left">
<input type="text" size="20" name="middle_name" value="<?php echo $row["middle_name"]?>" ></td>
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Birthdate
</td>
<td valign="top" align="left">
<input type="text" name="Birthdate" size="20" value="<?php echo $row["birthdate"]; ?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Age
</td>
<td valign="top" align="left">
<input readonly type="text" name="age" size="20" value="<?php echo $row["age"]?>" placeholder="YYYY-MM-DD"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<? if ($row["gender"]==Male) { ?>
<option value="Male" selected>Male</option>
<option value="Female">Female</option>
<? }else if ($row["gender"]==Female) { ?>
<option value="Male" >Male</option>
<option value="Female" selected>Female</option> <?php }?>
</select></tr>
</td><tr>
<td valign="top" align="right"> Civil Status:</td>
<td valign="top" align="left"><select name="civil_status">
<? if ($row["civil_status"]==Single) { ?>
<option value="Single" selected >Single</option>
<option value="Married">Married</option>
<option value="Separatede">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Married) { ?>
<option value="Single" >Single</option>
<option value="Married" selected>Married</option>
<option value="Separated">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Separated) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated" selected>Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Widowed) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated">Separated</option>
<option value="Widowed" selected>Windowed</option> <?php }?>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<? }
}
?>
</center>
</form>
|

I'm not sure if this is what you are referring to, as you've not specified a massive amount of information...
However,
You don't seem to have the actual <table> or </table> tags on this form...
No, opening <tr> tag (as pointed out by Tim Medora Below... Thanks!)...
And also no beginning <td valign="top" align="right"> Before your First name:<br>
<!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=iso-8859-1" />
<title>Clinical Module</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<body>
<form action='' method='POST'><center>
<input type="text" placeholder="Patient Number" name="search" > <input type="submit" Value="Check" name='submit'> <br>
<table>
<?php
mysql_connect("localhost","root","");
mysql_select_db("invoices");
$search = 0;
$search=$_POST['search'];
if (isset($_POST['submit'])){
$query = "select * from `patient` where `clientid` = $search ";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ?>
<tr>
<td valign="top" align="right">
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
</td>
</tr>
<tr>
<td valign="top" align="right">
Middle name:</td>
<td valign="top" align="left">
<input type="text" size="20" name="middle_name" value="<?php echo $row["middle_name"]?>" ></td>
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Birthdate
</td>
<td valign="top" align="left">
<input type="text" name="Birthdate" size="20" value="<?php echo $row["birthdate"]; ?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Age
</td>
<td valign="top" align="left">
<input readonly type="text" name="age" size="20" value="<?php echo $row["age"]?>" placeholder="YYYY-MM-DD"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<? if ($row["gender"]==Male) { ?>
<option value="Male" selected>Male</option>
<option value="Female">Female</option>
<? }else if ($row["gender"]==Female) { ?>
<option value="Male" >Male</option>
<option value="Female" selected>Female</option> <?php }?>
</select></tr>
</td><tr>
<td valign="top" align="right"> Civil Status:</td>
<td valign="top" align="left"><select name="civil_status">
<? if ($row["civil_status"]==Single) { ?>
<option value="Single" selected >Single</option>
<option value="Married">Married</option>
<option value="Separatede">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Married) { ?>
<option value="Single" >Single</option>
<option value="Married" selected>Married</option>
<option value="Separated">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Separated) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated" selected>Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Widowed) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated">Separated</option>
<option value="Widowed" selected>Windowed</option> <?php }?>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<? }
}
?>
</table>
</center>
</form>

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?

select option not displaying correctly after .load ajax

I am loading a php page into a spefific div, using this code
function peopleEdit(id, currid) {
$("#people_edit").load( "people_edit.php?id="+currid );
return false;
}
There are 2 issues though.
the form displayed, has the option values out of the select box, and the option is not working.
the tinymce box is displayed but the data are out of the box.
the form is tested and is working properly before the ajax .load
here's the html of the form.
<form action="people.php" enctype="multipart/form-data" name="pelatesForm" id="pelatesForm" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="20%" align="right">Τύπος</td>
<td width="80%"><label>
<select name="pelates_type_det" id="pelates_type_det" />
<option value="<?php echo $pelates_det_type ?>"><?php echo $pelates_det_type ?></option>
<option value="Πελάτης">Πελάτης</option>
<option value="Προμηθευτής">Προμηθευτής</option>
</select>
</label></td>
</tr>
<tr>
<td width="20%" align="right">Όνομα</td>
<td width="80%"><label>
<input name="pelates_first_name_det" type="text" id="pelates_first_name_det" size="64" value="<?php echo $pelates_det_first_name ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Επίθετο</td>
<td width="80%"><label>
<input name="pelates_last_name" type="text" id="pelates_last_name" size="64" value="<?php echo $pelates_det_last_name ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Τηλέφωνο - Σταθερό</td>
<td width="80%"><label>
<input name="pelates_phone" type="text" id="pelates_phone" size="64" value="<?php echo $pelates_det_phone ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Τηλέφωνο - Κινητό</td>
<td width="80%"><label>
<input name="pelates_cell" type="text" id="pelates_cell" size="64" value="<?php echo $pelates_det_cell ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Email</td>
<td width="80%"><label>
<input name="pelates_email" type="text" id="pelates_email" size="64" value="<?php echo $pelates_det_email ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Όνομα εταιρείας - Ιδιώτης</td>
<td width="80%"><label>
<input name="pelates_company" id="pelates_company" size="64" value="<?php echo $pelates_det_company ?>" />
</label>
</td>
</tr>
<tr>
<td width="20%" align="right">ΑΦΜ</td>
<td width="80%"><label>
<input name="pelates_afm" type="text" id="pelates_afm" size="64" value="<?php echo $pelates_det_afm ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">ΔΟΥ</td>
<td width="80%"><label>
<input name="pelates_doy" type="text" id="pelates_doy" size="64" value="<?php echo $pelates_det_doy ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Διεύθυνση</td>
<td width="80%"><label>
<input name="pelates_address" type="text" id="pelates_address" size="64" value="<?php echo $pelates_det_address ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Ταχυδρομικός κώδικας</td>
<td width="80%"><label>
<input name="pelates_tk" type="text" id="pelates_tk" size="64" value="<?php echo $pelates_det_tk ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Περιοχή</td>
<td width="80%"><label>
<input name="pelates_area" type="text" id="pelates_area" size="64" value="<?php echo $pelates_det_area ?>" />
</label></td>
</tr>
<tr>
<td width="20%" align="right">Σχόλια</td>
<td width="80%">
<textarea name="pelates_comments_det" type="text" class="tinymce" id="pelates_comments_det" size="64" /><?php echo $pelates_det_comments ?></textarea>
</td>
</tr>
<tr>
<td> </td>
<td><label>
<input name="thisID" type="hidden" value="<?php echo $targetID ?>" />
<input type="submit" name="submitpel" id="submitpel" value="Υποβολή" />
<input type="button" value="Άκυρο" onclick="return epistrofi('people_detailed','<?php echo $targetID ?>');" />
</label>
</td>
</tr>
</table>
</form>
any ideas of why is this happening?
You close your select :
<select name="pelates_type_det" id="pelates_type_det" />
Change to:
<select name="pelates_type_det" id="pelates_type_det">

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 >

Connecting 2 different databases doesn't work

First of all, I already know about how mysql_connect are not advisable to use but i have no time to learn the PDO commands and once I solve this first, i will change it to PDO. But now, im still having trouble merging two codes with different database connection on each file.
<?php
$dbh1 = mysql_connect('localhost', 'root', '');
$dbh2 = mysql_connect('localhost', 'root', '', true);
mysql_select_db('invoices', $dbh1);
mysql_select_db('hmis', $dbh2);
$id = '17';
/////
if ($id) {
echo "<h1>Edit Medical Records # : $id</h1>";
}
else
{
echo " <h1>Medical Records</h1>";
}
if($submit)
{
//-------------------check user name-----------------------------------------------------
$name = $_POST['name'];
$select = "select first_name from patient where last_name = '".$last_name."';";
$query = mysql_query($select,$dbh1) or die ("Mysql error! It was: ".mysql_error());
$rows = mysql_num_rows($query);
if ($rows != 0)
{
echo ("<script language=javascript>alert ('Sorry! $first_name is already taken!')</script>");
echo ("<script language=javascript>document.location.href = 'editclient.php'</script>");
exit;
}
if($name == "admin"){
echo ("<script language=javascript>alert ('Sorry! $first_name is not a good thing to do!')</script>");
echo ("<script language=javascript>document.location.href = 'editclient.php'</script>");
exit;
}
//-----------------------------------end check-------------------------------------------
$sql = "INSERT INTO patient (`first_name`, `last_name`,`country`, `address`, `gender`, `telno`, `occ`, `spo`, `occ2`,`cp`, `tel2`, `reff`, `all`, `ill`, `mat`, `frat`, `datetime`, `vs`,`ppe`, `ffup`)
VALUES ('$first_name','$last_name','$country','$address','$gender','$telno','$occ','$spo','$occ2', '$cp','$tel2','$reff','$all','$ill','$mat','$frat','$datetime','$vs','$ppe','$ffup')";
$result = mysql_query($sql,$dbh1);
//echo ("<script language=javascript>document.location.href = 'editclient.php?id=$id&message=Patient $id has been Created!'</script>");
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
window.location.href='sample4.php';
</SCRIPT>");
}
else if($update)
{
$sql = "UPDATE patient set first_name='$first_name',last_name='$last_name',
country='$country',address='$address',gender='$gender',telno='$telno',
occ='$occ',spo='$spo',occ2='$occ2', cp='$cp', tel2='$tel2',reff='$reff', ill='$ill', mat='$mat', frat='$frat', datetime='$datetime', vs='$vs', ppe='$ppe' ,ffup='$ffup'
WHERE clientid=$id";
$result = mysql_query($sql ,$dbh1);
//echo ("<script language=javascript>document.location.href = 'editclient.php?id=$id&message=Client $id has been Updated!'</script>");
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
window.location.href='sample4.php';
</SCRIPT>");
}
else if($id)
{
$result = mysql_query("SELECT * FROM patient WHERE clientid=$id",$dbh1);
$row = mysql_fetch_array($result);
?>
</p>
<br><font color=red size=4><?php if (isset($_GET['message'])) { echo ' - '.$_GET['message']; } ?></font><BR>
<?
//-------------NEXT PREVIOUS----------------------------------------------------------------------
$sql ="SELECT * FROM patient WHERE clientid < '$id' ORDER by clientid DESC LIMIT 1";
$resultp = mysql_query($sql ,$dbh1);
$previousrows = mysql_num_rows($resultp);
while ($prerow = mysql_fetch_array($resultp)) {
$prev=$prerow['clientid'];
}
//echo $prev;
$sql2 ="SELECT clientid FROM patient WHERE clientid > '$id' ORDER by clientid ASC LIMIT 1";
$resultn = mysql_query($sql2,$dbh1);
$nextrows = mysql_num_rows($resultn);
while ($nextrow = mysql_fetch_array($resultn)) {
$next=$nextrow['clientid'];
}
//echo $next;
if ($previousrows == "") {
echo "";
}else{
echo "<B><a href=$PHP_SELF?id=$prev>$prev <- Prev</a> | ";
}
echo "<font size=6><B>$id</B></font>";
if ($nextrows == "") {
echo "";
}else{
echo "<b> | <a href=$PHP_SELF?id=$next > Next -> $next</a></b>";
}
//-----------------end next prev-----------------------------------------------------
?><br><br>
<?php include("inc/nav.inc");?>
<form name="form2a" method="post" action="<?php echo $PHP_SELF?>">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Edit Patient Information:</td>
<td class=topHeadrow1 valign="middle" width="10" rowspan="20">
</td>
<td class=topHeadrow1 valign="middle" width="50%">
Procedures:</td>
</tr>
<tr>
<td valign="top" align="right">
<input type="hidden" name="id" value="<?php echo $row["clientid"]?>">
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
<!-- edit include inv -->
<?php //include ('testinclude.php'); ?>
<!-- END -->
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option> </select>
</td>
</tr>
<tr>
<td valign="top" align="right"> Country:</td>
<td valign="top" align="left">
<select name="country" >
<option value="Afghanistan">Afghanistan</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Bhutan">Bhutan</option>
<option value="Brunei">Brunei</option>
<option value="Cambodia">Cambodia</option>
<option value="China">China</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mongolia">Mongolia</option>
<option value="Myanmar">Myanmar (Burma)</option>
<option value="Pakistan">Pakistan</option>
<option value="Philippines">Philippines</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Singapore">Singapore</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Syria">Syria</option>
<option value="UAE">United Arab Emirates</option>
<option value="Uzbekistan">Uzbekistan</option>
</select>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Examination:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Date / Time:</td>
<td valign="top" align="left">
<input type="text" name="datetime" value="<?php echo $row["datetime"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Vital Signs:</td>
<td valign="top" align="left">
<input type="text" name="vs" value="<?php echo $row["vs"]?>" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Complain PPE Findings:</td>
<td valign="top" align="left">
<input type="text" name="ppe" value="<?php echo $row["ppe"]?>" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Plan / Management / FF-UP</td>
<td valign="top" align="left">
<input type="text" name="ffup" value="<?php echo $row["ffup"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="100%" colspan="4">
<p align="center"><input class="form-button" type="Submit" name="update" value="Update Information"></td>
</tr>
<tr>
<td valign="top" width="100%" colspan="4">
<br>
</td>
</tr>
</table>
</form>
<?
}
else
{
//----------------------------begin add client--------------------------------------------------------
?>
<br><font color=red size=4><?php if (isset($_GET['message'])) { echo ' - '.$_GET['message']; } ?></font><BR>
<form name="form2b" method="post" action="editclient.php" onSubmit="return checkPw(this)">
<table>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">Patient Information:</font></b></td>
</tr>
<tr>
<td valign="top" align="right">
First Name:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="first_name" ></td></tr>
<tr>
<td valign="top" align="right">
Last Name:</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20"></td></tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option> </select>
</td>
</tr>
<tr>
<td valign="top" align="right">Country:</td>
<td valign="top" align="left">
<select name="country" >
<option value="Afghanistan">Afghanistan</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Bhutan">Bhutan</option>
<option value="Brunei">Brunei</option>
<option value="Cambodia">Cambodia</option>
<option value="China">China</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mongolia">Mongolia</option>
<option value="Myanmar">Myanmar (Burma)</option>
<option value="Pakistan">Pakistan</option>
<option value="Philippines">Philippines</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Singapore">Singapore</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Syria">Syria</option>
<option value="UAE">United Arab Emirates</option>
<option value="Uzbekistan">Uzbekistan</option>
</select>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" ></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" ></td>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" ></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" ></td>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" ></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" size="50"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" size="31"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="200" colspan="5">
<b><font size="4">
Past Medical History:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" size="31"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" size="20"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">
Examination:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Date / Time:</td>
<td valign="top" align="left">
<input type="text" name="datetime" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Vital Signs:</td>
<td valign="top" align="left">
<input type="text" name="vs" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Complain PPE Findings:</td>
<td valign="top" align="left">
<input type="text" name="ppe" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Plan / Management / FF-UP</td>
<td valign="top" align="left">
<input type="text" name="ffup" size="31"></td>
</tr>
<tr>
<td width="10%"> </td>
<td width="90%"><input class="form-button" type="Submit" name="submit" value="Enter information"></td>
</tr>
</table>
</form>
<p> </p>
<?
}
?>
The result of the above code is on the screenshot above. I commented out the `include ('testinclude.php'). But once I include that file, all the data on the patient information is gone BUT the procedures column looks gone. I want both of them to show up.
When I include the testinclude.php. This is the result:
testinclude.php
<?
$id = '17';
//printf("<td align=left><font face=Verdana size=1 color=red>There are no Records</font></td>",$num); //prints number
$procedures = "SELECT * FROM incurredcharges WHERE patient_no = '$id'";
$result = mysql_query($procedures ,$dbh2);
if (mysql_num_rows($result) >= 1){
$procedures = "SELECT
`incurredcharges`.`procedure_no`,
`c`.`procedure`
FROM
incurredcharges
INNER JOIN (
SELECT `procedure`, `procedure_no` FROM `charges`
UNION ALL
SELECT `confinement`, `procedure_no` FROM `confinement`
UNION ALL
SELECT `service`, `procedure_no` FROM `ultrasound`
) c ON `incurredcharges`.`procedure_no` = c.`procedure_no`
WHERE `incurredcharges`.`patient_no` = '$id'";
$result2 = mysql_query($procedures ,$dbh2);
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow5><b>Procedure #</b></td>
<td class=topHeadrow5><b>Charge Incurred</b></td></tr>";
while($row = mysql_fetch_array($result2)){
echo '
<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>';
echo "</tr>";
}
echo '</table>';
}
else {
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow4><b>There are no Records</b></td></tr></table>";
return false;
}
?>
I already used the trick on connecting multiple databases. Every mysql_query, I specified what dtabase config it corresponds to. But it still doesnt work.
EDIT:
OK I just tried moving the include('testinclude.php') at the bottom. AND IT WORKED. It shows both the patient info and the procedures..
But in my official codes, it doesnt.
you have to create link for each database and pass that link to query
$link1 = mysql_select_db('invoices', $dbh1);
$link2 = mysql_select_db('hmis', $dbh2);
$sql1 = mysql_query($query1,$link1);
$sql2 = mysql_query($query2,$link2);
Please refer the below code,
$dbh1 = mysql_connect($hostname, $username, $password);
$dbh2 = mysql_connect($hostname, $username, $password, true);
mysql_select_db('database1', $dbh1);
mysql_select_db('database2', $dbh2);
Then to query database 1, do this:
mysql_query('select * from tablename', $dbh1);
and for database 2:
mysql_query('select * from tablename', $dbh2);
While opening second MySql connection, you need to pass 5th argument as true.
Please refer MySql manual,
resource mysql_connect (string $server, string $username,
string $password, bool $new_link = false )
new_link
If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters. In SQL safe mode, this parameter is ignored.
I hope this helps.

Connect two different database in one page

The second column, in the Procedures, it says there are no records. It shouldnt be like that. The results in there is from the data from another database. I already have the code for it and if I use include with a different php file with another mysql_connect configuration (from another database), the patient information isnt retrieved like the one seen here:
I know how to do multiple connections by storing different variables of the two connections.. But its much confusing to me cause its in different include files.
That page in the screenshot is editclient.php and i included editclient_include_inv.php where the code for the "procedures" section.
editclient.php
<?
include('header.php');
if ($id) {
echo "<h1>Edit Medical Records # : $id</h1>";
}
else
{
echo " <h1>Medical Records</h1>";
}
if($submit)
{
//-------------------check user name-----------------------------------------------------
$name = $_POST['name'];
$select = "select first_name from patient where last_name = '".$last_name."';";
$query = mysql_query($select) or die ("Mysql error! It was: ".mysql_error());
$rows = mysql_num_rows($query);
if ($rows != 0)
{
echo ("<script language=javascript>alert ('Sorry! $first_name is already taken!')</script>");
echo ("<script language=javascript>document.location.href = 'editclient.php'</script>");
exit;
}
if($name == "admin"){
echo ("<script language=javascript>alert ('Sorry! $first_name is not a good thing to do!')</script>");
echo ("<script language=javascript>document.location.href = 'editclient.php'</script>");
exit;
}
//-----------------------------------end check-------------------------------------------
$sql = "INSERT INTO patient (`first_name`, `last_name`,`country`, `address`, `gender`, `telno`, `occ`, `spo`, `occ2`,`cp`, `tel2`, `reff`, `all`, `ill`, `mat`, `frat`, `datetime`, `vs`,`ppe`, `ffup`)
VALUES ('$first_name','$last_name','$country','$address','$gender','$telno','$occ','$spo','$occ2', '$cp','$tel2','$reff','$all','$ill','$mat','$frat','$datetime','$vs','$ppe','$ffup')";
$result = mysql_query($sql);
//echo ("<script language=javascript>document.location.href = 'editclient.php?id=$id&message=Patient $id has been Created!'</script>");
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
window.location.href='sample4.php';
</SCRIPT>");
}
else if($update)
{
$sql = "UPDATE patient set first_name='$first_name',last_name='$last_name',
country='$country',address='$address',gender='$gender',telno='$telno',
occ='$occ',spo='$spo',occ2='$occ2', cp='$cp', tel2='$tel2',reff='$reff', ill='$ill', mat='$mat', frat='$frat', datetime='$datetime', vs='$vs', ppe='$ppe' ,ffup='$ffup'
WHERE clientid=$id";
$result = mysql_query($sql);
//echo ("<script language=javascript>document.location.href = 'editclient.php?id=$id&message=Client $id has been Updated!'</script>");
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
window.location.href='sample4.php';
</SCRIPT>");
}
else if($id)
{
$result = mysql_query("SELECT * FROM patient WHERE clientid=$id",$db);
$row = mysql_fetch_array($result);
?>
</p>
<br><font color=red size=4><?php if (isset($_GET['message'])) { echo ' - '.$_GET['message']; } ?></font><BR>
<?
//-------------NEXT PREVIOUS----------------------------------------------------------------------
$sql ="SELECT * FROM patient WHERE clientid < '$id' ORDER by clientid DESC LIMIT 1";
$resultp = mysql_query($sql);
$previousrows = mysql_num_rows($resultp);
while ($prerow = mysql_fetch_array($resultp)) {
$prev=$prerow['clientid'];
}
//echo $prev;
$sql2 ="SELECT clientid FROM patient WHERE clientid > '$id' ORDER by clientid ASC LIMIT 1";
$resultn = mysql_query($sql2);
$nextrows = mysql_num_rows($resultn);
while ($nextrow = mysql_fetch_array($resultn)) {
$next=$nextrow['clientid'];
}
//echo $next;
if ($previousrows == "") {
echo "";
}else{
echo "<B><a href=$PHP_SELF?id=$prev>$prev <- Prev</a> | ";
}
echo "<font size=6><B>$id</B></font>";
if ($nextrows == "") {
echo "";
}else{
echo "<b> | <a href=$PHP_SELF?id=$next > Next -> $next</a></b>";
}
//-----------------end next prev-----------------------------------------------------
?><br><br>
<?php include("inc/nav.inc");?>
<form name="form2a" method="post" action="<?php echo $PHP_SELF?>">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Edit Patient Information:</td>
<td class=topHeadrow1 valign="middle" width="10" rowspan="20">
</td>
<td class=topHeadrow1 valign="middle" width="50%">
Procedures:</td>
</tr>
<tr>
<td valign="top" align="right">
<input type="hidden" name="id" value="<?php echo $row["clientid"]?>">
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
<?
include('editclient_include_inv.php');
?>
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option> </select>
</td>
</tr>
<tr>
<td valign="top" align="right"> Country:</td>
<td valign="top" align="left">
<select name="country" >
<option value="Afghanistan">Afghanistan</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Bhutan">Bhutan</option>
<option value="Brunei">Brunei</option>
<option value="Cambodia">Cambodia</option>
<option value="China">China</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mongolia">Mongolia</option>
<option value="Myanmar">Myanmar (Burma)</option>
<option value="Pakistan">Pakistan</option>
<option value="Philippines">Philippines</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Singapore">Singapore</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Syria">Syria</option>
<option value="UAE">United Arab Emirates</option>
<option value="Uzbekistan">Uzbekistan</option>
</select>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Examination:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Date / Time:</td>
<td valign="top" align="left">
<input type="text" name="datetime" value="<?php echo $row["datetime"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Vital Signs:</td>
<td valign="top" align="left">
<input type="text" name="vs" value="<?php echo $row["vs"]?>" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Complain PPE Findings:</td>
<td valign="top" align="left">
<input type="text" name="ppe" value="<?php echo $row["ppe"]?>" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Plan / Management / FF-UP</td>
<td valign="top" align="left">
<input type="text" name="ffup" value="<?php echo $row["ffup"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="100%" colspan="4">
<p align="center"><input class="form-button" type="Submit" name="update" value="Update Information"></td>
</tr>
<tr>
<td valign="top" width="100%" colspan="4">
<br>
</td>
</tr>
</table>
</form>
<?
}
else
{
//----------------------------begin add client--------------------------------------------------------
?>
<br><font color=red size=4><?php if (isset($_GET['message'])) { echo ' - '.$_GET['message']; } ?></font><BR>
<form name="form2b" method="post" action="editclient.php" onSubmit="return checkPw(this)">
<table>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">Patient Information:</font></b></td>
</tr>
<tr>
<td valign="top" align="right">
First Name:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="first_name" ></td></tr>
<tr>
<td valign="top" align="right">
Last Name:</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20"></td></tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option> </select>
</td>
</tr>
<tr>
<td valign="top" align="right">Country:</td>
<td valign="top" align="left">
<select name="country" >
<option value="Afghanistan">Afghanistan</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Bhutan">Bhutan</option>
<option value="Brunei">Brunei</option>
<option value="Cambodia">Cambodia</option>
<option value="China">China</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mongolia">Mongolia</option>
<option value="Myanmar">Myanmar (Burma)</option>
<option value="Pakistan">Pakistan</option>
<option value="Philippines">Philippines</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Singapore">Singapore</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Syria">Syria</option>
<option value="UAE">United Arab Emirates</option>
<option value="Uzbekistan">Uzbekistan</option>
</select>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" ></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" ></td>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" ></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" ></td>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" ></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" size="50"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" size="31"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="200" colspan="5">
<b><font size="4">
Past Medical History:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" size="31"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" size="20"></td>
</tr>
<tr>
<td class="topHeadrow5" valign="top" width="100%" colspan="5">
<b><font size="4">
Examination:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Date / Time:</td>
<td valign="top" align="left">
<input type="text" name="datetime" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Vital Signs:</td>
<td valign="top" align="left">
<input type="text" name="vs" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Complain PPE Findings:</td>
<td valign="top" align="left">
<input type="text" name="ppe" size="31"></td>
</tr>
<tr>
<td align="center" nowrap>
Plan / Management / FF-UP</td>
<td valign="top" align="left">
<input type="text" name="ffup" size="31"></td>
</tr>
<tr>
<td width="10%"> </td>
<td width="90%"><input class="form-button" type="Submit" name="submit" value="Enter information"></td>
</tr>
</table>
</form>
<p> </p>
<?
}
?>
editclient_include_inv.php
<?
if ($num < 1){
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "hmis";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
//printf("<td align=left><font face=Verdana size=1 color=red>There are no Records</font></td>",$num); //prints number
$procedures = "SELECT * FROM incurredcharges WHERE patient_no = '$id'";
$result = mysql_query($procedures);
if (mysql_num_rows($result) >= 1){
$procedures = "SELECT
`incurredcharges`.`procedure_no`,
`c`.`procedure`
FROM
incurredcharges
INNER JOIN (
SELECT `procedure`, `procedure_no` FROM `charges`
UNION ALL
SELECT `confinement`, `procedure_no` FROM `confinement`
UNION ALL
SELECT `service`, `procedure_no` FROM `ultrasound`
) c ON `incurredcharges`.`procedure_no` = c.`procedure_no`
WHERE `incurredcharges`.`patient_no` = '$id'";
$result2 = mysql_query($procedures);
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow5><b>Procedure #</b></td>
<td class=topHeadrow5><b>Charge Incurred</b></td></tr>";
while($row = mysql_fetch_array($result2)){
echo '
<tr>
<td>'.$row[0].'</td>
<td>'.$row[1].'</td>';
echo "</tr>";
}
echo '</table>';
}
else {
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow4><b>There are no Records</b></td></tr></table>";
return false;
}
}
?>
The second code is for the Procedures column which is retrieved from another database.
You haven't posted any code, but from the text of your question, I can see that you're using mysql_connect() to connect to the database.
The first thing to learn here is not to use the mysql_xxx() functions. There are a lot of reasons for this -- for a start, they're deprecated, and also they're insecure.
There are two other APIs built into PHP that you should use instead: either mysqli or PDO.
But in this case, the even better reason for not using the mysql functions is that they make managing multiple DB connections much harder.
On the other hand, mananging multiple DB connections using either mysqli or PDO is extremely easy.
$db1 = new PDO('mysql:host=xxxxx,etc',$user1,$pass1);
$db2 = new PDO('mysql:host=xxxxx,etc',$user2,$pass2);
$db1->query('SELECT * FROM table_on_db1');
$db2->query('SELECT * FROM table_on_db2');
So you can keep as many connection objects active as you need, and just use the one that suits for any given query.
You can learn more about the mysqli API here: http://www.php.net/manual/en/book.mysqli.php
And about the PDO API here: http://php.net/manual/en/book.pdo.php
Hope that helps.
mysql_connect() returns a connection identifier which you need to store, and then pass in to all of your mysql_* functions. This is how you maintain multiple database connections per-script.
However, mysql_* functions are being deprecated and you should move to either PDO or mySQLi. This would have an added benefit of allowing you to initialize and store separate database objects instead of tracking connection identifiers. ie:
$db1 = new PDO('mysql:host=host1;dbname=db1', $user1, $pass1);
$db2 = new PDO('mysql:host=host2;dbname=db2', $user2, $pass2);

Categories