Jump to content

Recommended Posts

Heres what i wish to do:

 

a . Select a variable, say, country from a list of 200+ by typing the first few alphabets (say Bel ). This will throw up Belgium.Belize etc.

 

b. Select say, Belgium and then the list of cities there will pop up.

 

c. From that citylist, a selection will be made to pick out say, hotels.

 

The form will then get populated by other data that the user will enter.

 

d. The data for all 3 selections are in 3 separate tables linked with a common variable

Table A : CID,Co

Table B,  CID, Cityid, City

Table C : CID,Cityid, HID, Hotel

 

 

I have the foll code to make the search but am not abole to put all of it in a single page . Here's what i have so far :

 

 

OOPS ! Code didnt get posted in my earlier mail.

 


<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<title>REPORT</title>
<?
header("Cache-Control: public");
include ("../include/session.php"); // session start
include ("../indl.php"); //db info for DB2
$userid = $_SESSION['userid']; // works 
if(!isset($_SESSION['userid'])){
echo "<center><font face='Calibri' size='2' color=red>Sorry, Please login and use this page </font></center>";
exit;}

echo $userid; 
//works;

if(isset($_POST) && !empty($_POST["co"]))
{

?>


<b><p><font face="Tahoma" size="2" color="#0000FF">These are the cos in your database in the selected range. Please choose one</b></font><p>
<table border="1" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr bgcolor="#DEEDFE">


<form method="post" action="salesreport1.php?userid=<? echo $userid ?>">


<td><b><font size=2 face=Tahoma color=blue>Select</b></td>
<td><b><font size=2 face=Tahoma color=blue>C</b></td>
<td><b><font size=2 face=Tahoma color=blue>S</b></td>
<td><b><font size=2 face=Tahoma color=blue>L/b></td>
<tr>


<?


$sql = "SELECT *  FROM TableA c INNER JOIN TableB v USING(CID) INNER JOIN TableC a USING(AID) INNER JOIN Cities t USING(CITYID)WHERE c.`Co` LIKE '%$co%' ORDER BY `Company` asc";

//If there is no data in Table B or C), then the query returns no values - ie i get a blank table. I therefore would like for this to work in a way that I can first select a record from Table A and then work on B&C in the same script


$result = mysql_query($sql) or die (mysql_error ());
do {
    printf("<tr><td><input type=\"radio\" name=\"choice\" value=%d><td>
    <font size=2 face=Tahoma color=blue>%s<td>
    <font size=2 face=Tahoma color=blue>%s<td>
    <font size=2 face=Tahoma color=blue>%s<td>
         </tr>",
$myrow["CID"],
$myrow["Co"],
$myrow["St"],
$myrow["Lae"] );

  } while ($myrow = mysql_fetch_array($result));
  
?>
</table>
<p><input type="submit" value="Select">

</form>
<?php
}
else
{
  showForm();
}


function showForm()
{
$userid = $_GET["userid"];

?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="userid" value="<? echo $userid ?>">


<font face="Tahoma" size="3" color="#0000FF">Type the first few alphabets of the company name and then select one to add a report.<P>

<font face="Tahoma" size="2" color="#0000FF">Co:<input type="text" size="12" name="co">
<input type="submit" value="Go !">

</form>



<?php
}
?>


//</body>

</html>

Also, I need the drop downs to fit into this html code - not serially one after another. So am also stuck on where to create a "break" in the code so that the data comes into the necessary spaces on the html file.

 


<tr style='page-break-inside:avoid;height:12.95pt'>
  <td width=780 colspan=4 style='width:468.0pt;border:solid windowtext 1.0pt;
  border-top:none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'>
  <p class=MsoNormal><span lang=EN-US style='color:#000058'>Co: </span><select name=Dropdown1>
  <span lang=EN-US style='font-family:Calibri;color:#000058'> </a></span>   </td> </tr>
<tr style='page-break-inside:avoid;height:12.95pt'>
  <td width=780 colspan=4 style='width:468.0pt;border:solid windowtext 1.0pt;
  border-top:none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'>
  <p class=MsoNormal><span lang=EN-US style='color:#000058'>St:
  </span><select name=Dropdown2>
    </a></p>
  </td>
</tr>
<tr style='page-break-inside:avoid;height:12.95pt'>
  <td width=360 style='width:216.0pt;border:solid windowtext 1.0pt;border-top:
  none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'>
  <p class=MsoNormal><span lang=EN-US style='color:#000058'>City: </span><a
  name=Dropdown3></a></p>
  </td>
  <td width=180 colspan=2 style='width:108.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'>
  <p class=MsoNormal><span lang=EN-US style='color:#000058'>Lae: </span><a
  name=Dropdown4></a></p>
  </td>
  <td width=240 style='width:144.0pt;border-top:none;border-left:none;
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'>
  <p class=MsoNormal><span lang=EN-US style='color:#000058'>Pin Code:</span><a
  name=Dropdown5></a></p>
  </td>
</tr>

Also, I need the drop downs to fit into this html code - not serially one after another. So am also stuck on where to create a "break" in the code so that the data comes into the necessary spaces on the html file.

 

That's a shark with a lot of teeth, you defiantly have some homework to do. I would also look into div's it would clean that table mess up quickly.

hi,

 

true ! if there were a way i could just dump that html code into something which could give me the template i want and clean up the page, i would !

 

but 1st things 1st : I have to solve the php coding first.

 

@MrAdam:                     

Heres what i wish to do. The code I wrote works only if here is data in tables A,B&C. For example, if there is no hotel in Antwerp in Belgium, the entire row will return a null value so even Antwerp and Belgium dont show up.

But if there is Hotel X then we get all 3 bits of info in the table Hotel X | Antwerp | Belgium.

 

a . Select a variable, say, country from a list of 200+ by typing the first few alphabets (say Bel ). This will throw up Belgium.Belize etc.

 

b. Select say, Belgium and then the list of cities there will pop up.

 

c. From that citylist, a selection will be made to pick out say, hotels.

 

The form will then get populated by other data that the user will enter.

 

d. The data for all 3 selections are in 3 separate tables linked with a common variable

Table A : CID,Co

Table B,  CID, Cityid, City

Table C : CID,Cityid, HID, Hotel

@MrAdam:                     

Heres what i wish to do. The code I wrote works only if here is data in tables A,B&C. For example, if there is no hotel in Antwerp in Belgium, the entire row will return a null value so even Antwerp and Belgium dont show up.

But if there is Hotel X then we get all 3 bits of info in the table Hotel X | Antwerp | Belgium.

 

That's not a question.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.