Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Notepad++ or an ordinary ASCII text editor such as nano or vi . You may no

ID: 3858391 • Letter: U

Question

Using Notepad++ or an ordinary ASCII text editor such as nano or vi. You may not use HTML or wysiwyg editors.

Part 1: Using an XML Schema Write an XML file containing information for at least three types of tools (chisel.jpg, saw.jpg, and pliers.jpg). TPlace your XML file on the server as l6p1.xml.

Part 2; Validating form data: Make an order form from and name it l6p2.php. make the JavaScript code to calculate the total price. use a plain text box for quantities, the quantity inputs type="text".

Add JavaScript code to produce an error message and suppress submission of the form if any quantity field contains non-numeric data. (It's OK for a quantity to be empty, but if it's non-empty, it must have only numbers.) Add an action= attribute to your <form> tag to submit the form to http://weblab.kennesaw.edu/formtest.php. Test that the form is submitted correctly when the quantities are numeric or empty, and that an error message is produced otherwise. (Regular expressions are your friend. Anything that's not a digit is bad.

Part 3; Using PHP to generate forms: To your order form from Part 2, add input elements for customer name and address if they're not already there. The "state" part of the address must be a select element(also called a "pulldown menu") to allow the person placing the order to choose his or her state. Don't type all fifty states, but supply at least Georgia, Alabama and Florida. Put the names of the states in an PHP array and use PHP code to create the drop-down dynamically. (This will still be named l6p2.php; you're just adding to something you've already tested.)

Explanation / Answer

<html>

<head>

<script type="text/javascript">

function valid()

{

var ord=/^[0-9]{0,99}$/;

if(document.myform.qty.value.search(ord)==-1)

{

alert("Please Enter Valid Quantity");

document.myform.nme.focus();

return false;

}

else

{

alert("Done");

return true;

}

}

</script>

</head>

<body>

<form name="myform" method="post">

<table align="center" width="500">

<tr>

<td colspan="2"><center><font color="#FF0000" face="Arial Black, Gadget, sans-serif" size="+4">Order Booking</font></center></td></tr>

<tr>

<td>Quantity</td>

<td><input type="text" name="qty"></td>

</tr>

<tr>

<td colspan="2"><center><input type="submit" value="Submit"></center>

</td>

</tr>

</table>

</form>

<form name="regform" method="post" >

<table align="center" width="500">

<tr>

<td colspan="2"><center><font color="#0000FF" face="Arial Black, Gadget, sans-serif" size="+4">New Registration</font></center></td></tr>

<tr>

<td>Customer Name</td>

<td><input type="text" name="nme"></td>

</tr>

<tr><td>State</td>

<td><select>

<option selected="selected">Choose one</option>

<?php

  

$state = array("Georgia", "Alabama", "Florida", "New York");

  

  

foreach($state as $item){

?>

<option value="<?php echo strtolower($item); ?>"><?php echo $item; ?></option>

<?php

}

?>

</select>

</td>

</tr>

<tr>

<td colspan="2"><center><input type="submit" value="Submit" name="subreg"></center>

</td>

</tr>

</table>

</form>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote