
The.Pr0fess0r
Members-
Posts
25 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
The.Pr0fess0r's Achievements

Newbie (1/5)
0
Reputation
-
Show/Hide Div with Select statement
The.Pr0fess0r replied to The.Pr0fess0r's topic in Javascript Help
I'm sorry, i'm not sure what you are saying in either of those posts. Here is what I am trying to do... Question 1 Question 2 Dropdown 1 (by default Dropdown 1 is blank and all div's on the page are hidden) - Option 1 (Show only the div with an id of Option 1 -- hide all others) - Option 2 (Show only the div with an id of Option 2 -- hide all others) Question 3 Question 4 <div id="Option 1"> <table><tr><td> This is option 1 (i.e. more questions inside of tables/rows/columns) </td></tr></table> </div> Question 5 Question 6 <div id="Option 2> <table><tr><td> This is option 2 (i.e. more questions inside of tables/rows/columns) </td></tr></table> </div> Question 7 etc. That is the general layout of my page. I have a form that needs to be filled out. The forth question is a dropdown box (with a default selected value of null). On page load I want all div's to be hidden. Once a value is selected in the dropdown box I want the appropriate div or divs to show, but all others stay hidden. Does that explain things any better? PS - in my first post about half way down the code box is this statement: <div id="Whitetail Deer" style="display:none"> . Is that what you are talking about when you say -
Hello everyone, I am ready to pull my eyes out on this one. I am trying to show/hide different areas of my page using div tags and javascript. Here is the javascript file I am using: /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: Jay Rumsey | http://www.nova.edu/~rumsey/ */ function ShowReg(op) { document.getElementById('Whitetail Deer').style.display='none'; document.getElementById('Turkey').style.display='none'; document.getElementById('Ringneck Pheasant').style.display='none'; if (op == 1) { document.getElementById('Whitetail Deer').style.display="block"; } if (op == 2) { document.getElementById('Turkey').style.display="block"; } if (op == 3) { document.getElementById('Ringneck Pheasant').style.display="block"; } } Here is the section of my code where the div tags are: <tr> <td> <li class="mainForm" id="fieldBox_4"> <label class="formFieldQuestion">Species *</label> </td> <td> <select id="species" name="species" onChange="ShowReg(this.selectedIndex)"> <option selected> </option> <option value="Whitetail_Deer"> Whitetail Deer </option> <option value="Turkey"> Turkey </option> <option value="Ringneck Pheasant"> Pheasant </option> </select></li> </td> </tr> </table> <table> <tr> <td colspan="4"><br><u><b><font size="2">Animal Information </font></b></u></td> </tr> <tr> <td> <li class="mainForm" id="fieldBox_5"> <label class="formFieldQuestion">Sex</label> </td> <td> <select class=mainForm name=sex id=sex><option value=''></option><option value="Male">Male</option><option value="Female">Female</option></select></li> </td> </tr> <tr> <td> <li class="mainForm" id="fieldBox_6"> <label class="formFieldQuestion">Weight</label> </td> <td> <input class=mainForm type=text name=weight id=weight size='10' value=''></li> </td> <td> <li class="mainForm" id="fieldBox_7"> <label class="formFieldQuestion">Age</label> </td> <td> <input class=mainForm type=text name=age id=age size='10' value=''></li> </td> </tr> <tr> <td> <li class="mainForm" id="fieldBox_8"> <label class="formFieldQuestion">Weapon</label> </td> <td> <input class=mainForm type=text name=weapon id=weapon size='20' value=''></li> </td> <td> <li class="mainForm" id="fieldBox_9"> <label class="formFieldQuestion">Distance</label> </td> <td> <input class=mainForm type=text name=distance id=distance size='20' value=''></li> </td> </tr> <div id="Whitetail Deer" style="display:none"> <tr> <td> <li class="mainForm" id="fieldBox_10"> <label class="formFieldQuestion">Total Points</label> </td> <td> <input class=mainForm type=text name=total_points id=total_points size='20' value=''></li> </td> <td> <li class="mainForm" id="fieldBox_11"> <label class="formFieldQuestion">Type</label> </td> <td> <select class=mainForm name=type id=type><option value=''></option><option value="Typical">Typical</option><option value="NonTypical">NonTypical</option></select></li> </td> </tr> <tr> <td> <li class="mainForm" id="fieldBox_12"> <label class="formFieldQuestion">Net Score</label> </td> <td> <input class=mainForm type=text name=net_score id=net_score size='20' value=''></li> </td> <td> <li class="mainForm" id="fieldBox_13"> <label class="formFieldQuestion">Gross Score</label> </td> <td> <input class=mainForm type=text name=gross_score id=gross_score size='20' value=''></li> </td> </tr> </div> </table> <table> <tr> <td> <li class="mainForm" id="fieldBox_14"> <label class="formFieldQuestion">Misc Comments/Story <a class=info href=#><img src=imgs/tip_small.png border=0><span class=infobox>Enter your story here.</span></a></label> </td> <td> <textarea class=mainForm name=comments1 id=comments1 rows=20 cols=20></textarea></li> </td> </tr> </table> <table> <tr> <td colspan="4"><br><u><b><font size="2">Bird Information </font></b></u></td> </tr> <tr> <td> <li class="mainForm" id="fieldBox_15"> <label class="formFieldQuestion">Band #</label> </td> <td> <input class=mainForm type=text name=band id=band size='20' value=''></li> </td> </tr> <div id="Ringneck Pheasant" style="display:none"> <tr> <td> <li class="mainForm" id="fieldBox_16"> <label class="formFieldQuestion"># of Bars</label> </td> <td> <input class=mainForm type=text name=bars id=bars size='20' value=''></li> </td> </tr> </div> <div id="Turkey" style="display:none"> <tr> <td> <li class="mainForm" id="fieldBox_17"> <label class="formFieldQuestion">Length of Beard</label> </td> <td> <input class=mainForm type=text name=beard_length id=beard_length size='20' value=''></li> </td> <td> <li class="mainForm" id="fieldBox_18"> <label class="formFieldQuestion">Length of Spurs</label> </td> <td> <input class=mainForm type=text name=spur_length id=spur_length size='20' value=''></li> </td> </tr> </div> From everything I have been reading over the last couple of days it should work...but it doesn't. When I load the page all divs are shown and nothing happens when I select a different option in my drop down box. I think I need a new set of eyes. If anyone can help me it would be GREATLY appreciated! Thanks!
-
OK, that makes sense. How would I go about doing this then? Would I need to hard code the options in an HTML <select> tag...or is there a better way of doing this?
-
Hello, here is my situation... I have a dropdown box that is being populated from a table in my database. What I want to do is to only show certain fields in the form below based on what is selected in this box. I am using some JavaScript in other areas of my website to do just this...the only difference is in the other areas I have my dropdown box data hardcoded. Here is the JavaScript I am using: <script> //********************************************* // Function that Shows an HTML element //********************************************* function showDiv(divID) { var div = document.getElementById(divID); div.style.display = ""; //display div } //********************************************* // Function that Hides an HTML element //********************************************* function hideDiv(divID) { var div = document.getElementById(divID); div.style.display = "none"; // hide } //***************************************************************************** // Function that Hides all the Div elements in the select menu Value //***************************************************************************** function hideAllDivs() { //Loop through the seclect menu values and hide all var species = document.getElementById("species"); for (var i=0; i<=species.options.length -1; i++) { hideDiv(species.options[i].value); } } //********************************************* // Main function that calls others to toggle divs //********************************************* function toggle(showID) { hideAllDivs(); // Hide all showDiv(showID); // Show the one we asked for } </script> Here is the code I am using for my dropdown box: <? $sql = "SELECT species FROM animal_species"; // Echo echo "<SELECT name=\"species\">"; $result = mysql_query($sql); // Loop to get and echo the results as options while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row["species"].'">' .$row["species"].'</option>'; } echo "</SELECT>"; ?> OK, so I thought I would just add an if statement saying that if "x" is selected then show this div. Here is the code I have: <? if ($species = "Whitetailed Deer" OR $species = "Elk") { echo ShowDiv(1); } else { echo ShowDiv(2); } ?> But when I view this page I get an error for a call to an undefined function ShowDiv(). From my other code that is working I have to add this statement: onchange="toggle(this.options[this.options.selectedIndex].value) but i'm not sure where to add it. Any help would be greatly appreciated.
-
Thanks Bricktop! That worked great!
-
I'm not sure what is going on in the above code? Could you explain what it is saying a bit more? The category variable in the example, do I need to replace that with species? Also, what does the 'a' mean in statement: $a['category']? I'm just trying to get my head around what this statement is saying so I know how to edit it to get it to work with my code. Thanks for all your help.
-
Hello, I am currently working on an admin section for my site. I have a page that pulls in all the info in my database and then gives me the option to edit or delete the row of information. The problem I am having is when editing my drop down lists I cannot get it to pull in the information in the database. In the record entry screen (in the main part of my site) I am using the following code to populate the drop down box from fields in one of my db tables: <tr><td>Species:</td><td> <? $sql = "SELECT species FROM hunt_species"; // Echo echo "<SELECT name=\"species1\">"; $result = mysql_query($sql); // Loop to get and echo the results as options while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row["species"].'">' .$row["species"].'</option>'; } echo "</SELECT>"; ?> And that code works great to populate the dropdown box. The problem I am having now is that I don't know how to manipulate the above code to have it populate my dropdown box with the current value first and then give me the option (though the dropdown list) to change the value. All that is showing now is a dropdown box with the default value blank. Any help would be greatly appreciated.
-
Help linking query results to another page?
The.Pr0fess0r replied to The.Pr0fess0r's topic in PHP Coding Help
Thank you very much! I had to remove the set of parenthesis just after the = but then it started working. Now I am having problems getting the data to show on the resulting page. What do I have to use to get the data to show up on the trip page? I have the page set up the way I would like with the column headers (i.e. date of trip, hunters, etc) but the data will not show up. I know there is something I have to add to tell it where to pull it from, but i'm not sure what that statement is? If I just put <?php $date_of_hunt >? in a column, nothing shows up. How do I get it to pull the data? For example, on the report page (from the earlier post) let's say I click on the date with the id of 3...so my url looks like: http://www.mysite.com/trip.php?id=3. How do I get it to show the information from id 3? -
Hello, I have a query that outputs 5 columns of data. The first column is the date the trip was taken. I would like to be able to click on that date and have it take me to another page where it shows me all the info about that trip. The problem I am having is that I cannot get the syntax correct. Here is my line of code that I would like linked to another page: echo '<td width="50" align="right">' . substr($row['date_of_hunt'],0,10) . '</td><td width="20"></td>'; The page I want it linked to is trip.php I am using the field id in database. So i'm assuming it would be something like: trip.php?id=$row['id]..but I'm not sure how to put it all together. Any help would be greatly appreciated!
-
[SOLVED] Problem extracting data from Database
The.Pr0fess0r replied to The.Pr0fess0r's topic in PHP Coding Help
Wow, that was fast! Thank you very much for helping me out. As you can tell i'm just learning PHP, but i'm learning more and more every day just by reading these forums! Thanks again for your help! -
Hello everyone, here is my problem... I am trying to pull some data from my database. Here is the query I am using: $query = "SELECT * FROM hunt_info WHERE huntStatus = $key AND username = $username ORDER BY date_of_hunt DESC"; When I use the above code, this is what I get in the table where the data is supposed to be: SELECT * FROM hunt_info WHERE huntStatus = 1 AND username = Bob ORDER BY date_of_hunt DESC; So, it looks like it is pulling the variables correctly (key = 1 and username = Bob), but i'm not sure why it isn't displaying the data and only showing the query code? As soon as I take username = $username out of my query statement everything will display properly again. Here is the code for the entire column of my table: <td> <form action="hunt_reports.php" method="post"> Search: <input type="text" name="search" value="<?=$search;?>"> <input type="submit" value="search"> (Enter Date, Name of Hunter, or Species of Animal) </form><br> <?PHP { $status_array = array('1' => 'Successful', '2' => 'Unsuccessful'); foreach ($status_array as $key => $value) { echo '<font size=+1 color=blue><i>' . $value . '</i></font><br>'; $query = "SELECT * FROM hunt_info WHERE huntStatus = $key AND username = $username ORDER BY date_of_hunt DESC"; $result = @mysql_query ($query) or die ("$query"); echo '<table cellspacing="0" cellpadding="0">'; $i=0; while ($row = mysql_fetch_array ($result)) { $hunter = $hunter[0]; if($i==0) { echo '<tr><td align="center"><font size="-1">Date</font></td><td></td>'; echo '<td align="center"><font size="-1">Hunter</font></td><td></td>'; echo '<td align="center"><font size="-1">Location</font></td><td></td>'; echo '<td align="center"><font size="-1">Wind Direction</font></td><td></td>'; echo '<td align="center"><font size="-1">Harvested (Qty)</font></td><td></td>'; echo '<td align="center"><font size="-1">Sighted</font></td><td></td>'; echo '<td align="center"><font size="-1">Username</font></td><td></td>'; } if(fmod($i,2)==0) { $color = "#DCDCDC"; } else { $color = "#FFFFFF"; } $i++; echo '<tr bgcolor="' . $color . '">'; echo '<td width="50" align="right">' . substr($row['date_of_hunt'],0,10) . '</td><td width="20"></td>'; echo '<td width="50" align="center">' . $row['hunter'] . '</td><td width="20"></td>'; echo '<td width="80" align="center">' . $row['location'] . '</td><td width="20"></td>'; echo '<td width="80" align="center">' . $row['wind_direction'] . '</td><td width="20"></td>'; echo '<td width="100" align="center" nowrap>' . $row['species1'] . ' ' . $row[('qty1')] . '<br>' . $row['species2'] . ' (' . $row['qty2'] . ')<br>' . $row['species3'] . ' (' . $row['qty3'] . ')<br>' . $row['species4'] . ' (' . $row['qty4'] . ')</td><td width="20"></td>'; echo '<td width="100" align="center" nowrap>' . $row['sighted1'] . ' (' . $row['sighted_qty1'] . ')<br>' . $row['sighted2'] . ' (' . $row['sighted_qty2'] . ')<br>' . $row['sighted3'] . ' (' . $row['sighted_qty3'] . ')<br>' . $row['sighted4'] . ' (' . $row['sighted_qty4'] . ')<br></td><td width="20"></td>'; echo '<td width="30" align="center">' . $row['username'] . '</td><td width="20"></td>'; } if($i==0) echo '<tr><td><i>None</i></td></tr>'; echo '</table><br><br>'; } echo '</form>'; } ?> </td> Thank you for any help you can give me!
-
Problem getting function to update Total box
The.Pr0fess0r replied to The.Pr0fess0r's topic in Javascript Help
Wow! Thank you very much for that information. I just tested it and sure enough, my username and password was right there in plain text! -
Hello, I am in the process of creating a site our salesman can use to place orders for marketing items to give their customers. I have the form displaying properly and the subtotals are working, but I cannot for the life of me get the Total box at the bottom of the form to work. It is just blank no matter what. Basically my form has 6 columns. The form lists all items available to the salesman. The last two columns are qty and total (for that item). I am able to input a qty and the total for that item will appear properly. At the bottom of my form I have a total box that I want to populate with the total for the entire form and I cannot get that to populate for the life of me. My code is as follows: <?PHP session_start(); if(!session_is_registered(myusername)){ header("location: login.php"); } foreach ($_REQUEST as $key => $value) { $$key = $value; } include ("functions.inc"); include ("connection.inc"); db_connect () or die ("Cannot connect to server"); $query = "SELECT * FROM fulfillment_users WHERE username = '" . $_SESSION['useremail'] . "'"; $result = @mysql_query ($query) or die ("$query"); while ($row = mysql_fetch_array ($result)) { $usertype = $row['type']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Pragma" content="no-cache"> <SCRIPT language=JavaScript src="popup.js"></SCRIPT> <script type="text/javascript" src="includes/prototype.js"></script> <script type="text/javascript" src="includes/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="includes/lightbox.js"></script> <script type="text/javascript" src="includes/autocomplete.js"></script> <link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" /> <link rel="stylesheet" type="text/css" href="styles/autocomplete.css" /> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(form){ var URL = 'index.php?addressbook=' + document.form.addressbook.options[document.form.addressbook.selectedIndex].value; window.location.href = URL; } function updateTotal() { var totalval = 0 <?PHP if($usertype != '') { $query = "SELECT * FROM fulfillment_items WHERE itemType LIKE '%" . $usertype . "%' ORDER BY itemOrder"; }else{ $query = "SELECT * FROM fulfillment_items ORDER BY itemOrder"; } $result = @mysql_query ($query) or die ("$query"); $allitem = ''; while ($row = mysql_fetch_array ($result)) { echo ' if(document.items.elements[\'b' . $row['itemNumb'] . '\'].value > 0) totalval = totalval + parseFloat(document.items.elements[\'b' . $row['itemNumb'] . '\'].value)' . "\n"; } ?> document.items.elements['shipping_cost'].value = parseFloat(document.items.elements['shipping_cost'].value * 1).toFixed(2) document.items.elements['other_cost'].value = parseFloat(document.items.elements['other_cost'].value * 1).toFixed(2) totalval = totalval + parseFloat(document.items.elements['shipping_cost'].value) totalval = totalval + parseFloat(document.items.elements['other_cost'].value) document.items.total.value = totalval.toFixed(2) } function updateSubtotal(qty,sub,price) { var quantity = document.items.elements[qty].value * 1 var subtotal = quantity * price if(quantity > 0) { document.items.elements[sub].value = subtotal.toFixed(2) } else { document.items.elements[sub].value = '' } updateTotal() } function checkQty(qty,item,sub,price) { if(document.items.elements[item].value > qty) { var newqty var string = 'Maximum order quantity is: ' + qty alert(string) if(qty > 0) { newqty = qty } else { newqty = '' } document.items.elements[item].value = newqty updateSubtotal(item,sub,price) } } // End --> </SCRIPT> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1;no-cache"> <meta name="generator" content="Adobe Golive"> <title>Biewer Marketing Materials</title> <style type="text/css" media="screen"><!-- .class { font-size: 18px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold } .title { font-size: 16px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold } td { font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif } --></style> </head> <body onload="updateTotal();"> <div align="center"> <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <table width="685" border="0" cellspacing="0" cellpadding="0"> <tr> <td nowrap width="50%"><a href="index.php"><img src="images/logo.gif" alt="" border="0"></a></td> <td align="right" valign="bottom" nowrap width="50%"><span class="class">Biewer Marketing Materials</span></td> </tr> </table> </td> </tr> <tr> <td> <hr> </td> </tr> <tr> <td width="685" align="center"> <?PHP if($n != "") { if($n == "added") $notify = "Order Has Been Added"; if($n == "updated") $notify = "Order Has Been Updated"; ?> <table cellspacing="0" cellpadding="5" width="100%" style="background: #ffcccc; border-style: solid; border-width: 2px; border-color: #ff0000"> <tr><td width="100%" align="center" style="color: #000000"><?=$notify;?></td></tr> </table><br> <?PHP } ?> <form action="index.php" method="post" name="form"> <table cellpadding="0" cellspacing="0"> <tr><td colspan="10"><font size="+1">Address</font> <a href="index.php">[clear]</a></td></tr> <tr><td width="20"></td><td nowrap>Existing Address:</td><td></td><td colspan="10">Type name and select from dropdown to auto-populate address<br> <?PHP if($addressbook > 0) { $query = "SELECT * FROM fulfillment_addressbook WHERE addrId = $addressbook"; $result = @mysql_query ($query) or die ("$query"); while ($row = mysql_fetch_array ($result)) { $name = $row['addrName']; $store = $row['addrStore']; $address = $row['addrAddress']; $city = $row['addrCity']; $state = $row['addrState']; $zip = $row['addrZip']; $phone = $row['addrPhone']; $fax = $row['addrFax']; $email = $row['addrEmail']; } } $item_qty = array(); $query = "SELECT * FROM fulfillment_order_detail"; $result = @mysql_query ($query) or die ("$query"); while ($row = mysql_fetch_array ($result)) { $item_qty[$row['itemNumb']] -= $row['itemQty']; // $item_qty[$row['itemNumb']] = 10; } $query = "SELECT * FROM fulfillment_adjustment"; $result = @mysql_query ($query) or die ("$query"); while ($row = mysql_fetch_array ($result)) { $item_qty[$row['itemNumb']] += $row['adjQty']; // $item_qty[$row['itemNumb']] = 10; } if($orderId > 0) { $query = "SELECT * FROM fulfillment_order_header WHERE orderNumb = $orderId"; $result = @mysql_query ($query) or die ("$query"); while ($row = mysql_fetch_array ($result)) { $name = $row['orderName']; $store = $row['orderStore']; $address = $row['orderAddr']; $city = $row['orderCity']; $state = $row['orderState']; $zip = $row['orderZip']; $phone = $row['orderPhone']; $fax = $row['orderFax']; $email = $row['orderEmail']; $po = $row['orderPO']; $cc_number = $row['orderCCNumber']; $cc_expire = $row['orderCCExpire']; $shipping = $row['orderShipping']; $shipping_cost = number_format($row['orderShippingAmount'],2); $other_cost = number_format($row['orderOtherAmount'],2); $total = number_format($row['orderTotalAmount'],2); } $query = "SELECT * FROM fulfillment_order_detail WHERE orderNumb = $orderId"; $result = @mysql_query ($query) or die ("$query"); $order_qty = array(); $order_price = array(); $item_subtotal = array(); while ($row = mysql_fetch_array ($result)) { $order_qty[$row['itemNumb']] = $row['itemQty']; $item_qty[$row['itemNumb']] += $row['itemQty']; $item_subtotal[$row['itemNumb']] = number_format(($row['itemQty'] * $row['itemPrice']),2); // $order_price[$row['itemNumb']] = $row['itemPrice']; } } ?> <input type="text" name="addressbook1" value="<?=$name;?>" style="width: 300px"> <script type="text/javascript"> new CAPXOUS.AutoComplete("addressbook1", function() { return "includes/autocomplete1.php?typing=" + this.text.value; }); </script> </td></tr></form> <tr><td> </td></tr> <form action="order.php" method="post" name="items"> <input type="hidden" name="useremail" value="<?=$_SESSION["useremail"];?>"> <input type="hidden" name="usertype" value="<?=$usertype;?>"> <?PHP if($addressbook > 0) { ?> <input type="hidden" name="addressbook" value="<?=$addressbook;?>"> <?PHP } ?> <?PHP if($orderId > 0) { ?> <input type="hidden" name="orderId" value="<?=$orderId;?>"> <?PHP } ?> <tr><td width="20"></td><td>Name:</td><td width="10"></td><td colspan="10"><input type="text" name="name" size="30" value="<?=$name?>"></td></tr> <tr><td width="20"></td><td>Store Name:</td><td width="10"></td><td colspan="10"><input type="text" name="store" size="30" value="<?=$store?>"></td></tr> <tr><td width="20"></td><td>Address:</td><td width="10"></td><td colspan="10"><input type="text" name="address" size="30" value="<?=$address?>"></td></tr> <tr><td width="20"></td><td>City:</td><td width="10"></td><td><input type="text" name="city" size="16" value="<?=$city?>"></td> <td width="5"></td><td>State:</td><td width="10"></td><td> <select name="state"> <? form_state($state); ?> </select> </td> <td width="20"></td><td>Zip:</td><td width="10"></td><td><input type="text" name="zip" size="10" value="<?=$zip?>"></td></tr> <tr> <td width="20"></td><td>Phone:</td><td width="10"></td><td><input type="text" name="phone" size="16" value="<?=$phone?>"></td> <td width="5"></td><td>Fax:</td><td width="10"></td><td><input type="text" name="fax" size="16" value="<?=$fax?>"></td> </tr> <tr><td width="20"></td><td>Email:</td><td width="10"></td><td colspan="10"><input type="text" name="email" size="30" value="<?=$email?>"></td></tr> <tr><td> </td></tr> <tr><td width="20"></td><td>PO Number:</td><td width="10"></td><td colspan="10"><input type="text" name="po" size="30" value="<?=$po?>"></td></tr> <tr> <td width="20"></td><td nowrap>Shipping Method:</td><td width="10"></td> <td> <select name="shipping"> <option value="ground" <? if($shipping == "ground") echo "selected"; ?>>Ground <option value="secondday" <? if($shipping == "secondday") echo "selected"; ?>>Second Day <option value="nextdayafternoon" <? if($shipping == "nextdayafternoon") echo "selected"; ?>>Next Day (5:00pm) <option value="nextafternoon" <? if($shipping == "nextafternoon") echo "selected"; ?>>Next Afternoon <option value="nextdaymorning" <? if($shipping == "nextdaymorning") echo "selected"; ?>>Next Day (10:30am) <option value="satdelivery" <? if($shipping == "satdelivery") echo "selected"; ?>>Saturday Delivery </select> </td> </tr> <table> </td> </tr> <tr><td> </td><tr> <tr> <td width="685" align="center"> <table cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top"><font size="+1">Item#</font></td><td></td> <td align="center" valign="top"><font size="+1">Description</font><br>(Click product description for image)</td><td></td> <td align="center" valign="top"><font size="+1">Price</font></td><td></td> <td align="center" valign="top"><font size="+1">Stock</font></td><td></td> <td align="center" valign="top"><font size="+1">Qty</font></td><td></td> <td align="center" valign="top"><font size="+1">Total</font></td><td></td> </tr> <tr><td> </td></tr> <?PHP if($usertype != '') { $query = "SELECT * FROM fulfillment_items WHERE itemType LIKE '%" . $usertype . "%' ORDER BY itemOrder"; }else{ $query = "SELECT * FROM fulfillment_items ORDER BY itemOrder"; } $result = @mysql_query ($query) or die ("$query"); $i=0; while ($row = mysql_fetch_array ($result)) { $itemDesc = $row['itemDesc']; if($row['itemBrand'] != '') $itemDesc .= ' (Logo: ' . $row['itemBrand'] . ')'; if($row['itemColor'] != '') $itemDesc .= ' (' . $row['itemColor'] . ')'; if($row['itemSize'] != '') $itemDesc .= ' (' . $row['itemSize'] . ')'; if($row['itemLogoColor'] != '') $itemDesc .= ' (' . $row['itemLogoColor'] . ')'; if($row['itemHeader'] != '') { ?> <tr><td> </td></tr> <tr><td></td><td></td><td align="center"><b><?=str_replace("\n","<br>",$row['itemHeader']);?></b></td></tr> <tr><td> </td></tr> <?PHP } if(fmod($i++,2)==0) { $color = "#FFFFFF"; } else { $color = "#FFFFFF"; } if(!file_exists("images/" . $row['itemImage'])) $row['itemImage'] = "coming_soon.jpg"; ?> <tr bgcolor="<?=$color;?>"> <td width="100" valign="top" nowrap><?=$row['itemNumb'];?></td><td width="10"></td> <td width="380" valign="top"><a href="images/<?=$row['itemImage'];?>" title="<?=$row['itemDescLong'];?>" rel="lightbox"><?=$itemDesc;?></a><? if($row['itemNew'] != '' && $row['itemNew'] >= date("Ymd")) echo ' <font color="red">***NEW***</font>'; ?><br><?=$row['itemDetail'];?></td><td width="10"></td> <td align="right" valign="top">$<?=number_format($row['itemPrice'],2);?></td><td width="10"></td> <td align="right" valign="top"><?=$item_qty[$row['itemNumb']]+0;?></td><td width="10"></td> <td align="center" valign="top" nowrap> <?PHP if($item_qty[$row['itemNumb']] <= 0) { echo 'Out'; } else { // $max_order = min($item_qty[$row['itemNumb']],10); $max_order = $item_qty[$row['itemNumb']]; if($row['itemNumb'] == '65000') $max_order = 2; echo '<input type="text" name="a' . trim($row['itemNumb']) . '" value="' . $order_qty[$row['itemNumb']] . '" size="3" STYLE="text-align:right" onkeyup="updateSubtotal(\'a' . trim($row['itemNumb']) . '\',\'b' . trim($row['itemNumb']) . '\',' . $row['itemPrice'] . '); checkQty(' . max(0,$max_order) . ',\'a' . trim($row['itemNumb']) . '\',\'b' . trim($row['itemNumb']) . '\',' . $row['itemPrice'] . ')" >'; } ?> </td> <td width="10"></td><td valign="top" align="right"><input type="text" size="7" name="b<?=trim($row['itemNumb']);?>" value="<?=$item_subtotal[$row['itemNumb']];?>" STYLE="text-align:right" tabindex="999" readonly></td> <td><img src="images/blank.gif" height="24" width="1"></td> </tr> <?PHP } ?> <tr><td colspan="9" align="right">Shipping:</td><td></td><td align="right" colspan="2"><input type="text" size="7" name="shipping_cost" value="<?=$shipping_cost;?>" onblur="updateTotal()" STYLE="text-align:right" tabindex="997"> <tr><td colspan="9" align="right">Other:</td><td></td><td align="right" colspan="2"><input type="text" size="7" name="other_cost" value="<?=$other_cost;?>" onblur="updateTotal()" STYLE="text-align:right" tabindex="998"></td> <tr><td colspan="9" align="right">Total:</td><td></td><td align="right" colspan="2"><input type="text" size="7" name="total" value="<?=$total;?>" STYLE="text-align:right" tabindex="999" readonly></td><td><img src="images/blank.gif" height="24" width="1"></td></tr> </table><br> <input type="submit" value="Submit"> </form> </td> </tr> <tr> <td> <hr> </td> </tr> <tr> <td width="685" align="center"> <form action="index.php" method="post" name="form"> <table cellpadding="0" cellspacing="0"> <tr><td colspan="10"><font size="+1">Open Orders</font><br><br></td></tr> <?PHP $query = "SELECT * FROM fulfillment_order_header WHERE orderStatus = 1 ORDER BY orderNumb DESC"; $result = @mysql_query ($query) or die ("$query"); if(mysql_num_rows($result) == 0) echo '<tr><td colspan="10" align="center">No Open Orders</td></tr>'; $i=0; while ($row = mysql_fetch_array ($result)) { if(fmod($i++,2)==0) { $color = "#DCDCDC"; } else { $color = "#FFFFFF"; } ?> <tr bgcolor="<?=$color;?>"> <td width="40" valign="top" align="right"><?=$row['orderNumb'];?></td><td width="10"></td> <td width="200" valign="top"><a href="index.php?orderId=<?=$row['orderNumb'];?>"><?=$row['orderName'];?> <?=$row['orderStore'];?></a></td><td width="10"></td> <td width="200" valign="top"><?=$row['orderCity'];?>, <?=$row['orderState'];?> <?=$row['orderZip'];?></td><td width="10"></td> <td width="50" valign="top" align="right">$<?=number_format($row['orderTotalAmount'],2);?></td><td width="10"></td> <td width="155" valign="top" align="right"><?=$row['orderDate'];?></td> <td><img src="images/blank.gif" height="24" width="1"></td> </tr> <?PHP } ?> </table><br><br> <a href="logout.php">[logout]</a> </div> </body> </html> It's the function updateTotal() that I am having problems with. Any help would be greatly appreciated.