Jump to content

FrankieGee

Members
  • Posts

    9
  • Joined

  • Last visited

FrankieGee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have attached the entire file. There are many lines that have been commented out, as I am still experimenting with this.salesquote.php
  2. Thank you for the reply, but I have tried this one and get an error: Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING
  3. I am trying to show each checked item in a new row in an html (php) table. Currently, it is working when one selection has been made via a checkbox, but when a new selection is made, the first one is overwritten. I call my Checkboxes like this: echo "<input type=\"checkbox\" rel=\"textbx1\" name=\"$item_no\">$item_no $ihddescr_1</input><br />"; Which gives me a list of items from a selected vendor. I then use this table below, as I will need to show cost, price, etc in a table. echo "<table border ='0' width='100%'><tr><td align='center'><strong><font size='4'><font color='#008301'>Quote Items</font></strong></td></tr></table>"; echo "<table border ='1' width='100%'>"; echo "<th>Item ID</th>"; echo "<th>Description</th>"; echo "<th>QTY</th>"; echo "<th>Sell Price</th>"; echo "<th>Cost</th>"; echo "<th>Prft%</th>"; echo "<th>Prft$</th></tr>"; $quoted = "<td><text id=\"textbx1\"></text></td><td></td><td> </td><td> </td><td> </td><td><input type='text' name='profit' size='6'> </td><td> </td></tr>"; { $cscode=odbc_result($rs,"cscode"); $csname=odbc_result($rs,"csname"); $item_no=odbc_result($rs,"item_no"); $order_date=odbc_result($rs,"order_date"); $order_date2 = date( "m-d-Y", strtotime( $order_date ) );*/ $getQuote=array("$item_no \"\n\""); foreach ($getQuote as $item) $item = "$quoted"; { echo $quoted; } odbc_close($conn); echo "</table>"; I should also add that I am using Javascript to populate the rows. <script type="text/javascript"> $(window).load(function(){ $(document).ready(function() { $("input[type=checkbox]").click(function() { if ($(this).is(':checked')) $('#textbx1').html($('#textbx1').val() + $(this).attr('name') + "\n"); else { var text = $('#textbx1').val(); text = text.replace($(this).attr('name') + "\n" ,""); $('#textbx1').html(text); } }); }) }); </script> Any help what-so-ever would be appreciated. Thanks.
  4. I am trying to accomplish a table to be filled with selections from a database using php and javascript. My javascript code is: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script type='text/javascript' src='http://code.jquery.com/jquery-1.7.js'></script> <script type="text/javascript"> $(window).load(function(){ $(document).ready(function() { $("input[type=checkbox]").click(function() { if ($(this).is(':checked')) $('#textbx1').html($('#textbx1').val() + $(this).attr('name') + "\n"); else { var text = $('#textbx1').val(); text = text.replace($(this).attr('name') + "\n" ,""); $('#textbx1').html(text); } }); }) }); </script> and my table code is: echo "<input type=\"checkbox\" rel=\"textbox\" name=\"$item_no\">$item_no</input><br />"; } echo "<br />"; echo ""; echo "</table>"; echo "</table>"; echo "<table border ='0' width='100%'><tr><td align='center'><strong><font size='4'><font color='#008301'>Quoted Items</font></strong></td></tr></table>"; echo "<table border ='1' width='100%'>"; echo "<th>Item ID</th>"; echo "<th>Description</th>"; echo "<th>QTY</th>"; echo "<th>Sell Price</th>"; echo "<th>Cost</th>"; echo "<th>Prft%</th>"; echo "<th>Prft$</th></tr>"; /* while (odbc_fetch_row($rs)) { $cscode=odbc_result($rs,"cscode"); $csname=odbc_result($rs,"csname"); $item_no=odbc_result($rs,"item_no"); $order_date=odbc_result($rs,"order_date"); $order_date2 = date( "m-d-Y", strtotime( $order_date ) );*/ echo "<tr><td><text id=\"textbx1\" \"r\"\"n\"></text></td>"; echo"<td>$ </td>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td> </td></tr>"; //} // odbc_close($conn); echo "</table>"; This Javascript is populating in one cell of the table, but will not show new (or next) item in a new cell. It overwrites the first cell. Any ideas? Thank you for looking.
  5. @DavidAM and @Mac_Gyver, Thank you very much. Both of your posts helped me to solve this issue. Now... on to mode coding... Thanks again
  6. Troubles abound. What I am trying to achieve is to populate a form using data from a MSSQL database. First, the user will select a company from a dropdown list **WORKING** Then, the company name will appear on the form **WORKING** Now, as the code is set below, the Customer Number, Address, etc WILL populate, but only from the last record in the database. While the company name will change upon selection of the dropdown menu, everthing else remains the same. I am using $_POST to populate the company name from the dropdown. Here is my code: echo "<table border ='0' width='90%'><tr><td align='center'><strong><font size='4'><font color='#008301'>Load Customer</font></strong></td></tr></table>"; echo "<table border ='1' width='90%'><tr><td>"; echo "<form method=\"post\" action='salesquote.php'>"; echo "<select name=\"pcsname\">"; echo "<option>Select Company</option>"; $sql="select csname, cscode from customer where sacode = $sacode order by csname"; $rs=odbc_exec($conn,$sql); if (!$rs) echo"Error in SQL"; while(odbc_fetch_row($rs)) { $csname=odbc_result($rs,"csname"); echo "<option value=\"$csname\">$csname</option>"; } echo "</select>"; echo "<input type=\"submit\">"; echo "</form>"; echo "</td></tr>"; echo "</table>"; echo "</form>"; echo "</tr></table>"; echo "<br />"; odbc_close($conn); echo "<table border ='0' width='100%'><tr><td align='center'><strong><font size='4'><font color='#008301'>Quote Information</font></strong></td></tr></table>"; echo "<table border ='1' width='100%'>"; echo "<tr><td>Quote Date</td>"; echo "<td>"; echo date("F d, Y"); echo "</td></tr>"; echo "<tr><td>Inquiry Date</td>"; echo"<td><input type='text' size='20'></td></tr>"; echo "<tr><td>Sales Person $pcscode</td>"; echo "<td>"; ?><?php include 'addons/loginArray.php';?><?php echo "</td></tr>"; echo "</table>"; echo "<br />"; echo "<table border ='0' width='100%'><tr><td align='center'><strong><font size='4'><font color='#008301'>Customer Information</font></strong></td></tr></table>"; echo "<table border ='1' width='100%'>"; include 'addons/connection.php'; $sql="select cscode, csphone, csaddr1, csaddr2, cscity, csst, cszip from customer where sacode = $sacode order by csname"; $rs=odbc_exec($conn,$sql); if (!$rs) echo"Error in SQL"; while(odbc_fetch_row($rs)) { $cscode=odbc_result($rs,"cscode"); $csphone=odbc_result($rs,"csphone"); $csaddr1=odbc_result($rs,"csaddr1"); $csaddr2=odbc_result($rs,"csaddr2"); $cscity=odbc_result($rs,"cscity"); $csst=odbc_result($rs,"csst"); $cszip=odbc_result($rs,"cszip"); } echo "<tr><td width=\"40%\">Customer Number</td>"; echo"<td>$cscode</td></tr>"; echo "<tr><td>Company Name</td>"; echo "<td>$pcsname</td></tr>"; echo "<tr><td>Customer Phone</td>"; echo "<td>$csphone</td></tr>"; echo "<tr><td>Address 1</td>"; echo "<td>$csaddr1</td></tr>"; echo "<tr><td>Address 2</td>"; echo "<td>$csaddr2</td></tr>"; echo "<tr><td>Address 3</td>"; echo "<td>$cscity $csst $cszip</td></tr>"; odbc_close($conn); echo "</table>"; If, however, I do somethiong like this: $sql="select cscode, csphone, csaddr1, csaddr2, cscity, csst, cszip from customer where sacode = $sacode and csname = $pcsname"; I would expect this to give me the required information by referencing the company name already set above. Instead, I get an SQL ERROR Again, if I remove the line: csname = $pcsname I get the last record in the databse associated with $sacode. any thoughts? Thank you in advance
  7. Looking at this with fresh eyes, I was able to gain the results I needed. echo "<table border ='1' width='90%'><tr><td>"; echo "<select name=\"test\">"; echo "<option>Select Company</option>"; $sql="select csname from customer where sacode = $sacode order by csname"; $rs=odbc_exec($conn,$sql); if (!$rs) echo"Error in SQL"; while(odbc_fetch_row($rs)) { $csname=odbc_result($rs,"csname"); echo "<option value=\"$csname\">$csname</option>"; } echo "</select>"; echo "</td></tr>"; odbc_close($conn); echo "</table>"; Thanks everyone! I am sure to have more questions as this project progresses forward.
  8. Thank you Barand and Phyco. I have edited the script to reflect the proposed changes and I am still unable to actually see the results. Again, there is a 'placeholder' if you will, where the data should be. I have counted 102 rows inside the database for this user ($sacode =26) and 102 rows for the Select function.
  9. I am trying to figure this out. When I run the below code, I DO get spaces inside my <select><option></option></select> code, but I can not see anything but blank spaces. echo "<table border ='1' width='90%'><tr><td>"; echo "<select name=\"test\">"; $sql="select csname from customer where sacode = $sacode"; $rs=odbc_exec($conn,$sql); if (!$rs) echo"Error in SQL"; while($row=odbc_fetch_row($rs)) { echo "<option value=.$row[csname].</option>"; } echo "</select>"; echo "</td></tr>"; odbc_close($conn); echo "</table>"; When I run the same code to output into a table, everything is fine. Any ideas?
×
×
  • 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.