Hello All, I am fairly new to the PHP and MySQL world and I was wondering if you could offer some advise or tutorials that may help me achieve my objectives. My code is pasted on the far bottom. I currently have a form page and results page. The first thing I would like to do is combine the form page with the results so that a new page isn't opened when the end user hits the submit. The second is how do I change my javascript form script so that the second and third menu is hidden until the prior menu is selected. The third is: How can I use PHP ternary instead of my current if else on the form page? The fourth is: How can I alter my results page so that the records can me edited. For example once the query is submitted and the results are displayed. I would like to edit any field in any record and submit the changes back to the database. Is this possible?? Thank you in advance! Chris form page below: <!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"> <?php require "../PHP_Scripts/config.php"; // Your Database details ?> <head> <title>KCRF Dashboard</title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type='text/javascript' src='../js/jquery-1.2.3.js'></script> <script type='text/javascript' src='../js/menu.js'></script> </head> <body> <div id="boundary"> <h1>type something</h1> <ul id="nav"> <li><a href="#">Home</a></li> <li><a href="#">EVDO PCMD</a></li> <li><a href="#">Voice PCMD </a> <ul> <li><a href="#">3.1 jQuery</a> <ul> <li><a href="#">3.1.1 Download</a></li> <li><a href="#">3.1.2 Tutorial</a></li> </ul> </li> <li><a href="#">3.2 Mootools</a></li> <li><a href="#">3.3 Prototype</a></li> </ul> </li> </ul> <div id="content"> </div> </div> <p id="footer">type something</a>, type something</a></p> <SCRIPT language=JavaScript> function reload(form) { var val=form.term.options[form.term.options.selectedIndex].value; self.location='kpiForm.php?term=' + val ; } function reload2(form) { var val=form.term.options[form.term.options.selectedIndex].value; var val2=form.term2.options[form.term2.options.selectedIndex].value; self.location='kpiForm.php?term=' + val + '&term3=' + val2 ; } </script> <?PHP ///////// Getting the data from Mysql table for first list box////////// $market=mysql_query("SELECT DISTINCT market FROM sector_list ORDER BY market DESC"); /////// for second drop down list we will check if market is selected else we will display all the cell_sectors///// $term=$_GET['term']; // This line is added to take care if your global variable is off if(isset($term) and strlen($term) > 0) { $cellSect=mysql_query("SELECT DISTINCT cell_sect FROM sector_list where market like '%$term' order by cell_sect"); } else { $cellSect=mysql_query("SELECT DISTINCT cell_sect FROM sector_list order by cell_sect"); } ////////// end of query for second subcategory drop down list box /////////////////////////// $term3=$_GET['term']; // This line is added to take care if your global variable is off /////// for Third drop down list we will check if cell_sect is selected else we will display all the dates///// if(isset($term3) and strlen($term3) > 0) { $date=mysql_query("SELECT DISTINCT date FROM evdo WHERE market LIKE '%$term' ORDER BY date DESC"); } else { $date=mysql_query("SELECT DISTINCT date FROM evdo ORDER BY date"); } ////////// end of query for third subcategory drop down list box /////////////////////////// echo "<form method=post name=f1 action='PHP_Scripts/search.php'>"; ////////// Starting of first drop downlist ///////// echo "<select name='term' onchange=\"reload(this.form)\"> <option value=''>Market</option>"; while($menu1 = mysql_fetch_array($market)) { if($menu1['market']==@$term) { echo "<option selected value='$menu1[market]'>$menu1[market]</option>"."<BR>"; } else { echo "<option value='$menu1[market]'>$menu1[market]</option>"; } } echo "</select>"; ////////// Starting of second drop downlist ///////// echo "<select name='term2' onchange=\"reload2(this.form)\"> <option value=''>Cell_Sector</option>"; while($menu2= mysql_fetch_array($cellSect)) { if($menu2['cell_sect']==@$term2) { echo "<option selected value='$menu2[cell_sect]'>$menu2[cell_sect]</option>"."<BR>"; } else { echo "<option value='$menu2[cell_sect]'>$menu2[cell_sect]</option>"; } } echo "</select>"; ////////// Starting of third drop downlist ///////// echo "<select name='term3'> <option value=''>Timestamp</option>"; while($menu3 = mysql_fetch_array($date)) { if($menu3['date']==@$term3) { echo "<option selected value='$menu3[date]'>$menu3[data]</option>"."<BR>"; } else { echo "<option value='$menu3[date]'>$menu3[date]</option>"; } } echo "</select>"; ////////////////// This will end the third drop down list /////////// echo "<input type=submit value='Submit'></form>"; ?> </body> </html> results page below: <!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"> <?php require ("config.php"); // Your Database details ?> <head> <title>PCMD KPI</title> <style type="text/css" > TABLE { margin-left: auto; margin-right: auto; border: 1px solid #98bf21; border-collapse:collapse; } TH { border: 1.5px solid #000000; padding-bottom: 2px; padding-left: 7px: padding-right: 7px; padding-top: 2px; font-size: 1.0em; background-color:limegreen; color: white; text-align: center; } TD { border: 1px solid #98bf21; padding-bottom: 2px; padding-left: 7px: padding-right: 7px; padding-top: 2px; font-size: 1.0em; text-align: center; } TR.alt TD { background-color: #eaf2d3; text-align: center; } #navbar ul { margin: 0; padding: 5px; list-style-type: none; text-align: center; background-color: #000; } #navbar ul li { display: inline; } #navbar ul li a { text-decoration: none; padding: .2em 1em; color: #fff; background-color: #000; } #navbar ul li a:hover { color: #000; background-color: #fff; } --> </style> </head> <fieldset style="border: 1px ridge limegreen; color: limegreen;"> <legend style="color: #000; font-family: verdana; font-size: 14pt;">PCMD KPI</legend> <body> <div id="navbar"> <ul> <li><a href="/php/drop_down/index.php">Home</a></li> <li><a href="/php/drop_down/dd3.php">PCMD KPI</a></li> <li><a href="/php/drop_down/banding.php">EVDO Distance Banding</a></li> <li><a href="#">LinkHere</a></li> <li><a href="#">LinkHere</a></li> </ul> </div> </fieldset> <?php $term=$_POST['term']; $term2=$_POST['term2']; $term3=$_POST['term3']; # your orignal that just pulls the market data #$result = mysql_query("select * FROM evdo WHERE Market like '%$term' LIMIT 20"); #this pulls the cell_sect assigned to market $result = mysql_query("select * FROM evdo WHERE Market like '%$term' and Cell_Sect = '$term2' ORDER BY date desc LIMIT 96"); #This pulls the cell_sect on given date and market #$result = mysql_query("select * FROM evdo WHERE Market like '%$term' and Cell_Sect = '$term2' and Date = '$term3'"); # you need to modify the first page to autopopulate the cell_sect and date option boxes # so it only list the cells applicable to a market on a given day $firstRow=1; $rowNum = 0; echo "<table>"; while($row = mysql_fetch_assoc($result)) { if($firstRow == 1) { echo "<tr>"; foreach($row as $key => $value) { echo "<th>" . $key . "</th>"; } echo "</tr><tr>"; $firstRow=0; $rowNum++; } else { if( ($rowNum++ % 2) == 1) { echo "<tr class=\"alt\">"; } else { echo "<tr>"; } } foreach($row as $key => $value ) { echo "<td>" . $value . "</td>" ; } echo "</tr>"; } echo "</table>"; echo "You Selected the following:<br>Market = $term <br>Cell_Secter = $term2<br>Timestamp = $term3"; ?> </body> </html> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php