Public feed
#601761
<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Assignment 6 Part 3/4</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><meta http-equiv="Content-Script-Type" content="type/javascript" /><style type="text/css"> table.items { border-collapse: separate; empty-cells: show; caption-side: top; border: solid; border-width: 2px; width: 50%; float: left; table-layout: fixed; } table.shipping { border-collapse: separate; empty-cells: show; caption-side: top; border: none; border-width: 1px; width: 50%; float: left; table-layout: fixed; } td.Tool { border: double; border-width: 1px; text-align: left; width: 50%; } td.Weight { border: double; border-width: 1px; text-align: left; width: 20%; } td.Price { border: double; border-width: 1px; text-align: right; width: 15%; } td.Amount { border: double; border-width: 1px; text-align: right; width: 15%; overflow: hidden; } td.info { border: none; border-width: 1px; text-align: left; width: 25%; } td.input_info { border: none; border-width: 1px; text-align: left; width: 75%; }</style></head><body><script type = "text/javascript"><!-- listArray = new Array(); function valid(blur) { listArray.push(blur); } function validation() { alert(listArray); var i; var box; var reg = new RegExp(/\d|\s/); var zipcode = document.getElementById("zip"); if(reg.test(zipcode) == false) { return false; } for(i in listArray) { box = document.getElementById(listArray[i]); if(reg.test(box) == false) { return false; } else { } } return true; }//--></script><form action="http://webdev.spsu.edu/formtest.php" onsubmit = "return validation()"> <table class = "shipping"> <caption>Shipping Information</caption> <tr> <td class = "info">Full Name</td> <td class = "input_info"> <input type = "text" name = "name" maxlength = "25" size = "25" /> </td> </tr> <tr> <td class = "info">Address</td> <td class = "input_info"> <input type = "text" name = "Address" maxlength = "50" size = "50" /> </td> </tr> <tr> <td class = "info">City</td> <td class = "input_info"> <input type = "text" name = "City" maxlength = "20" size = "20" /> </td> </tr> <tr> <td class = "info">Zip</td> <td class = "input_info"> <input type = "text" name = "Zip" maxlength = "9" size = "9" id = "zip" /> </td> </tr> <tr> <td class = "info">State</td> <td class = "input_info"> <select name = "State"> <?php $db = pg_connect("dbname=webdev"); $query = "SELECT state_abbr, state_name from state_t ORDER BY state_name;"; foreach(pg_fetch_all(pg_query($query)) as $index) { print(" <option value=\"$index[state_abbr]\"> $index[state_name] </option> "); } ?> </select> </td> </tr> </table> <div style="clear:both"/> <table class = "items"> <caption>Tool Prices</caption> <tr> <td class = "Tool" style = "font-weight: bold;">Tool</td> <td class = "Weight" style = "font-weight: bold;">Weight</td> <td class = "Price" style = "font-weight: bold;">Price</td> <td class = "Amount" style = " font-weight: bold;">Amount</td> </tr> <?php $db = pg_connect("dbname=webdev"); $query = "select hdw_part_no, hdw_name, hdw_price, hdw_weight from hardware_t order by hdw_name;"; foreach(pg_fetch_all(pg_query($query)) as $index) { print(" <tr> <td class = \"Tool\">$index[hdw_name]</td> <td class = \"Weight\">$index[hdw_weight]</td> <td class = \"Price\">$index[hdw_price]</td> <td class = \"Amount\"> <input type = \"text\" name = \"$index[hdw_part_no]\" maxlength = \"11\" id = \"$index[hdw_part_no]\" onblur = \"valid(this.id)\" /> </td> </tr> "); } ?> </table> <div style="clear:both"></div> <p> <input type = "radio" name = "payment" value = "visa" checked = "checked" /> Visa <input type = "radio" name = "payment" value = "mc" checked = "checked" /> Master Card <input type = "radio" name = "payment" value = "amex" checked = "checked" /> American Express </p> <p> <input type = "submit" value = "Place Order" /> </p></form></body></html>