Jump to content

mick_otoole

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mick_otoole's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. As I said earlier I'm a complete beginner so excuse the stupid questions in advance ... Are you saying that I have to put the [code]$tireqty = $_POST["tireqty"];[/code] in the orderform.html or the processorder.php file? Once again please excuse the ignorance!
  2. 'm trying to teach myself PHP and I've been working form a numer of different books. THe problem I'm having is when I pass form variables from one page to another they do not appear. A very simple example is when I try to pass values from this page (orderform.html) [code]<HTML> <form action="processorder.php" method=post> <table border=0> <tr bgcolor=#cccccc> <td width=150>Item</td> <td width=15>Quantity</td> </tr> <tr> <td>Tires</td> <td align=center><input type=”text” name=”tireqty” size=3 maxlength=3></td> </tr> <tr> <td>Oil</td> <td align=center><input type=”text” name=”oilqty” size=3 maxlength=3></td> </tr> <tr> <td>Spark Plugs</td> <td align=center><input type=”text” name=”sparkqty” size=3 maxlength=3></td> </tr> <tr> <td colspan=2 align=center><input type=submit value=”Submit Order”></td> </tr> </table> </form> </HTML>[/code] i.e. The Values tireqty, oilqty and sparkqty to the following page (processorder.php) [code]<html> <head> <title>Bob’s Auto Parts - Order Results</title> </head> <body> <h1>Bob’s Auto Parts</h1> <h2>Order Results</h2> <?php echo ("Order Processed on :"); echo date(" jS F, H:i"); echo "<br>"; echo "<p>Your order is as follows:"; echo "<br>"; echo $tireqty." tires<br>"; echo $oilqty." bottles of oil<br>"; echo $sparkqty." spark plugs<br>"; ?> </body> </html>[/code] THe values that I type in do not show up. The only thing that appears on the page is the descriptions. I know that there is probably a very very simple solution for this I just can't seem to find it! Oh yeah and before you ask I have installed Apache and PHP on my local machine!!!
  3. I can see from the code [code]if (!isset($start)) $start = 0; $display = $listdisplay; $prev_value = $start - $display; $next_value = $start + $display; $recordCount = $display+1; $showPrevNext = 'false'; [/code] That the next button will just take the start and add on the $listdisplay basically abandoning the search query completely. I'm still trying to figure out how to pass the query through the next button. Anyone ??? Please? I'm going frigging nuts trying to figure this out!
  4. I've seen this in a few other posts on this forum but no one has answered those posts either. Please Please can someone please help with this query. Thanks in advance. Mick
  5. Hey all, this is my first post here so be gentle! I'm working with a database that has a list of companies in it. When the user authenticates he/she is given a list of all companies in the database. There is a search box whereby a user can search for specific companies. The problem that I'm having is that if there are more than 20 matches for a search string a <Next> button appears on the bottom of the page. When the user clicks on the next button the page that is displayed is not related to the original search query. I was wondering if anyone can help me out on how to display only relevant results on the <Next> page. Here's my code: [code]/* $Id: PageName.php,v 1.46 2006/08/03 12:40:41 Mick Exp $ <?php session_start() ; require_once 'DB.php'; require_once 'functions.inc'; require_once 'HTMLGenerator.php'; require_once 'Client.inc'; require_once 'Order.inc'; require_once 'Constants.inc'; require_once $path_required_scripts.'Bizunit.inc'; $_SESSION['menu_to_display'] = 'clients'; pull_from_get('deleteclient','clientid','start','created'); pull_from_post('filter','form_clientname','form_filterbizunit'); pull_from_session('os_session_user_id'); if (!isset($os_session_user_id) || $os_session_user_id == NULL || $os_session_user_id == -1)         header('Location: index.php'); foreach(array("form_clientname","filter","form_filterbizunit") as $variable)         if (!isset($$variable))                 $$variable = ""; $params = array(); $strFeedback = ""; if (!isset($start)) $start = 0; $display = $listdisplay; $prev_value = $start - $display; $next_value = $start + $display; $recordCount = $display+1; $showPrevNext = 'false'; //if "company" logged in, display all clients, else only clients for this reseller if ($os_session_user_id == 1000)         $reseller = ""; else         $reseller = " and u.reseller_id = ".$os_session_user_id; $strSelect = 'Select u.* from user u, client_information c where c.user_id = u.user_id and c.client_account_activated = 1 '.$r eseller .' limit '. $start . ',' . $display; if (isset($filter) && $filter == 'Search') {                 //$strSelect = "select * from client_information where client_company_name like ? or client_last_name like ? or client_first_name like ?";                 $strTmp = "'%" . $form_clientname . "%'";                 $bizunitsql="";                 if((isset($form_filterbizunit)) && (!($form_filterbizunit==-1))) { $bizunitsql=" and c.bizunit=$form_filterbiz unit";  };                 $strSelect = "select c.* from client_information c, user u where c.user_id=u.user_id and c.client_account_act ivated = 1 and (u.username like ".$strTmp . " or c.client_company_name like " . $strTmp . " or c.client_last_name like  " . $s trTmp . "  or c.client_first_name like  " . $strTmp . ")".$reseller . $bizunitsql . " limit ". $start . "," . $display;                 $res1 =& getRecordSetMessengerDB("select count(*) from client_information c, user u where c.user_id = u.user_i d and (c.client_company_name like " . $strTmp . " or c.client_last_name like  " . $strTmp . "  or c.client_first_name like  " . $strTmp.") ".$reseller, $params);                 $row =& $res1->fetchRow();                 $recordCount = $row[0];                 //echo $strSelect;                 if ($recordCount > $display) $showPrevNext = 'true';                 //$params = array($form_filterorderid);                 //$params =  array("%" . $form_clientname . "%","%" . $form_clientname . "%","%" . $form_clientname . "%","%" . $form_clientname . "%"); } if (isset($deleteclient) && $deleteclient == 'true') {         $client = new Client();         $client->deleteClient($clientid); } if (isset($created) && $created == 'new') {         $strFeedback = "Client and Client Account have been created successfully"; } PrintHeader("OrderSystem -- Client Overview"); PrintLayoutTop("Client List", "Click on a Client Name to view the details", $os_session_user_id); if ($strFeedback != "")         echo '<div align=center><span class = "blue11">'.$strFeedback.'</span></div><br>'; ?> <form method="post" action="PageName.php"> <br> <table border = 1 rules = none width = 50% align = center> <tr>         <td class=bold_text>Client Search</td>         <td><input name="form_clientname" size = 13 value="<?php echo $form_clientname; ?>"></td> </tr>       <tr>                 <th class="bold_text" align=left>Biz Unit</th>                 <th class="bold_text" align=left>                                                 <select name=form_filterbizunit><option value='-1'></option>                                                 <?php                                                         $bizunit = new Bizunit();                                                         $bizunits = $bizunit->getBizunitIDList();                                                         for ($i=0; $i < count($bizunits); $i++)                                                         {                                                                         $strSelected = "";                                                                 if ($bizunits[$i]==$form_filterbizunit) { $strSelected=" SELEC TED "; };                                                                 $bizunit = new Bizunit($bizunits[$i]);                                                                 echo '<option value=' . $bizunits[$i] . ' ' . $strSelected.'>' . $bizunit->getBizunitName() . '</option>';                                                         }                                                 ?>                                         </select> </th>                 <th class="bold_text" align=left><input type="submit" name="filter" value="Search"></th>         </tr> </table> </form> <br> <?php         $res =& getRecordSetMessengerDB($strSelect, $params);         ?> <table width= 100% border="1" rules = rows class="text" align="left">         <tr>                 <th class=greybg align="left">Username</th>                 <th class=greybg align="left">Company</th>                 <th class=greybg ></th>                 <th class=greybg ></th>         </tr>         <?php         $i = 0;         while ($row =& $res->fetchRow())         {                 $strBackground = "";                 $user = new Client($row[0]);                 ?>                 <tr <?php echo $strBackground; ?> >                         <td>                           <a title = "Edit Client" href= "EditClient.php?<?php echo "clientid=" . $row[0] ?>"> <?php echo $use r->getClientUsername(); ?> </a>                         </td>                         <td>                           <?php echo $user->getClientCompanyName(); ?>                         </td>                         <td>                           <a title="display client's orders" href = "OrderOverview.php?<?php echo "clientid=" . $row[0] ?>">ge t orders</a>                         </td>                         <td>                           <a title="Delete Client" href= "PageName.php?<?php echo "deleteclient=true&clientid=" . $row[0 ] ?>" >x</a>                         </td>                 </tr>         <?php         }         ?>         </table>         <div style = "color:white">a</div>         <table width=100%>         <tr>                 <td width=90%></td>                 <td width=10%>                         <?php                         if (($recordCount > $display) || ($showPrevNext == 'true'))                         {                                 if ($start > 0)                                 {                                 ?>                                         <a href = "PageName.php?start=<?php echo $prev_value;?>"> prev </a>                                 <?php                                 }                                 ?>                 </td>                 <td>                                         <a href = "PageName.php?start=<?php echo $next_value;?>"> Next </a>                         <?php                                 }                                 ?>                 </td>         </tr>         </table> <?php PrintLayoutBottom(); PrintFooter(); ?> [/code] I hope this explains properly what I'm trying to do. Thanks in advance for any help that you can give me. Mick
×
×
  • 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.