SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 6 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 11 Dec 2017 My Price 10.00

correct symbols in the email or if it includes symbols

What can I add to validate the email?

So that an error message pops up when it doesn't have the correct symbols in the email or if it includes symbols that

are invalid?.

Thank you.<? session_start(); ?>
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function checkNewCust(){
        var submitOK = true;
        var alertstring =="";
        var x1 = document.getElementById("custID").value;
        var x2 = document.getElementById("phone").value;
        var x3 = document.getElementById("zip").value;
        var x4 = document.getElementById("fax").value;
        var phonePat = /^\d{3}-\d{3}-\d{4}$/; // xxx-xxx-xxxx format
        var matchArray = x2.match(phonePat); // tests to see if x2 matches phonePat
        var matchArray1 = x4.match(phonePat); // tests to see if x4 matches phonePat
        if(isNaN(x1)) {
            alertstring = "Please input a numeric value for Customer ID.";
        }
        if(matchArray == null) {
            alertstring = "Phone Number must be in xxx-xxx-xxxx format.";
        }
    
        if(isNaN(x3)) {
            alertstring = "Please input a numeric value for Zipcode.";
        }
        if(matchArray1 == null) {
            alertstring = "Fax Number must be in xxx-xxx-xxxx format.";
        }
            
        if(alertstring!=""){
            alert(alertstring);
            submitOK = false;
        }
        return submitOK;
    }
</script>
<link rel="stylesheet" type="text/css" href="/projstyle.css" />
<title>Piedmont Furnishings
</title>
</head>

<?
    $db = mysqli_connect("localhost", "student", "student", "furnish") or die("I cannot connect to the database because: " . mysqli_connect_error());  // connect to the database server
?>
<body>
<h1>Piedmont Furnishings Edit Customer Form</h1>
<h6> <? print $_SESSION["empname"];?> </h6>

                        
                        <? $emp_id = $_SESSION["emp_id"];?>
                        <? $strSQL = "SELECT job_id FROM employee WHERE emp_id = '$emp_id'";
                        print "*" . $strSQL . "*" . "<br />";?>
                        <? $rs = mysqli_query($db, $strSQL); ?>
                        <?$row = mysqli_fetch_assoc($rs);?>
<h3>
                            <? if ($row["job_id"] == 3 || $row["job_id"] == 4){?>
                            &nbsp;&nbsp;&nbsp;<a href="/employee.php">Home</a>&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;<a href="/orders.php">Orders</a>&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;<a href="/customers.php">Customers</a>&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;<a href="/login.php">Logout</a>&nbsp;&nbsp;&nbsp;
                        <?}else{?>
                            &nbsp;&nbsp;&nbsp;<a href="/manager.php">Home</a>&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;<a href="/orders.php">Orders</a>&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;<a href="/customers.php">Customers</a>&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;<a href="/reports.php">Reports</a>&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;<a href="/login.php">Logout</a>&nbsp;&nbsp;&nbsp;
                        <?}?>
</h3>

<hr />


<?
$cust = $_POST['customer'];

$strSQL = "SELECT region_id FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL . "*" . "<br />";
$result = mysqli_query($db, $strSQL);
$row = mysqli_fetch_array($result);
$rs = $row[0];    

$strSQL2 = "SELECT cust_company FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL2 . "*" . "<br />";
$result = mysqli_query($db, $strSQL2);
$row = mysqli_fetch_array($result);
$rs2 = $row[0];    

$strSQL3 = "SELECT cust_lname FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL3 . "*" . "<br />";
$result = mysqli_query($db, $strSQL3);
$row = mysqli_fetch_array($result);
$rs3 = $row[0];    

$strSQL4 = "SELECT cust_fname FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL4 . "*" . "<br />";
$result = mysqli_query($db, $strSQL4);
$row = mysqli_fetch_array($result);
$rs4 = $row[0];    

$strSQL5 = "SELECT cust_address FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL5 . "*" . "<br />";
$result = mysqli_query($db, $strSQL5);
$row = mysqli_fetch_array($result);
$rs5 = $row[0];    

$strSQL6 = "SELECT cust_city FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL6 . "*" . "<br />";
$result = mysqli_query($db, $strSQL6);
$row = mysqli_fetch_array($result);
$rs6 = $row[0];    

$strSQL7 = "SELECT cust_state FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL7 . "*" . "<br />";
$result = mysqli_query($db, $strSQL7);
$row = mysqli_fetch_array($result);
$rs7 = $row[0];    

$strSQL8 = "SELECT cust_zip FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL8 . "*" . "<br />";
$result = mysqli_query($db, $strSQL8);
$row = mysqli_fetch_array($result);
$rs8 = $row[0];    

$strSQL9 = "SELECT cust_phone FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL9 . "*" . "<br />";
$result = mysqli_query($db, $strSQL9);
$row = mysqli_fetch_array($result);
$rs9 = $row[0];    

$strSQL10 = "SELECT cust_fax FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL10 . "*" . "<br />";
$result = mysqli_query($db, $strSQL10);
$row = mysqli_fetch_array($result);
$rs10 = $row[0];    

$strSQL11 = "SELECT cust_email FROM customer WHERE cust_ID = '$cust'";
print "*" . $strSQL11. "*" . "<br />";
$result = mysqli_query($db, $strSQL11);
$row = mysqli_fetch_array($result);
$rs11 = $row[0];    

?>



<br />
<form name="newcust" method="post" action="editcustoutput.php" onsubmit="return checkNewCust();">>
<label for= "custID">Customer ID:</label><input type="text" name="custID" value = <?= $cust ?> id="custID" size ="40" readonly>
<br />
<br />
<label for= "region">Region:</label><?    
            $strSQL16 = "SELECT region_id FROM region ORDER BY region_id ASC";
            $rs16 = mysqli_query($db, $strSQL16);  // recordset
        ?>
    <select name="region" id="region">
    <? while($row = mysqli_fetch_array($rs16)){ ?>
    <? if($row[0] == $rs){ ?>
                <option value="<?= $row[0]?>" selected="selected"><?= $row[0] ?></option>
            <?}else{?>
                <option value="<?= $row[0]?>"><?= $row[0] ?></option>
            <? }?>
    <? } ?>
    </select>
<br />
<br />
<label for= "cname">Company Name: </label><input type="text" name="cname" value = <?= $rs2 ?> id="cname" size ="40" required>
<br />
<br />
<br />
<h4>Contact Information:</h4>
<br />
<label for= "lname">Last Name: </label><input type="text" name="lname" value = "<?= $rs3 ?>" id="lname" size ="40" required>
<br />
<br />
<label for= "fname">First Name: </label><input type="text" name="fname" value = "<?= $rs4 ?>" id="fname" size ="40" required>
<br />
<br />
<label for= "streetAddy">Street Address: </label><input type="text" name="streetAddy" value = "<?= $rs5 ?>" id="streetAddy" size ="40" required>
<br />
<br />
<label for= "streetAddy2">Apt/Floor/P.O. Box: </label><input type="text" name="streetAddy2" id="streetAddy2" size ="40" >
 <br />
 <br />
<label for= "city">City: </label><input type="text" name="city" value = "<?= $rs6 ?>" id="city" size ="40" required> &nbsp;
<br />
<br />
<label for= "state">STATE:</label>
<?    
            $strSQL17 = "SELECT DISTINCT cust_state FROM customer ORDER BY cust_state ASC";
            $rs17 = mysqli_query($db, $strSQL17);  // recordset
        ?>
    <select name="state" id="state">
        
    <? while($row = mysqli_fetch_array($rs17)){ ?>
    <? if($row[0] == $rs7){ ?>
                <option value="<?= $row[0]?>" selected="selected"><?= $row[0] ?></option>
            <?}else{?>
                <option value="<?= $row[0]?>"><?= $row[0] ?></option>
            <? }?>
    <? } ?>
    </select>
<br />
<br />
<label for= "zip">ZIP: </label><input type="text" name="zip" value = "<?= $rs8 ?>" id="zip" size ="40" required>
<br />
<br />
<label for= "phone">Phone: </label><input type="text" name="phone" value = "<?= $rs9 ?>" id="phone" size ="40" required>&nbsp;
<br />
<br />
<label for= "fax">Fax: </label><input type="text" name="fax" value = "<?= $rs10 ?>" id="fax" size ="40" >&nbsp;
<br />
<br />
<label for= "email">Email: </label><input type="text" name="email" value = "<?= $rs11 ?>" id="email" size ="40" required>
<br />
<br />
<h5><input type="submit" name="submit" value="Submit" size="20" />
&nbsp;<input type="reset" value="Reset" size="20" /></h5>

<?
// mysqli_free_result($rs); throwing an error
   mysqli_close($db);
?>
</form>

</body>
</html>

Answers

(5)
Status NEW Posted 11 Dec 2017 01:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)