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

I have this problem in my php file. I try to put text box for a zip code. This i

ID: 3663982 • Letter: I

Question

I have this problem in my php file. I try to put text box for a zip code.

This is my code for the form:

<div class="myRow">

<label class="labelCol" for="myZipcode">Zip Code: </label>

<input type="text" name="myZipcode" id="myZipcode"

   value="<?php if(isset($_GET['myZip'])) echo $_GET['myZip']; ?>"/>

</div>

This is the code for Painter page:

// Validate the Zip code:
if (is_numeric($_GET['myZip code'])) {

   $myZip = $_GET['myZip code'];

}

else {

   $myZip = NULL;

   echo '<p class="error"><font color="red"><b>You forgot to enter your City!</b></font></p>';
}

Free Estimate We will contact you to arrange your free estimate Here is the information you entered: Notice: Undefined index: myZip code in C:linetpublsiteslcsc301lnkulalshahrani11Pashalpainter.php on line 63 Notice: Undefined index: myZip code in C:inetpublsiteslcsc301lnkulalshahrani1Pashalpainter.php on line 114 You forgot to enter your City!

Explanation / Answer

Regarding the error on lines 63 and 64. You have to use "myZipcode" instead of myZip code. You placed space in the variable name. And makesure you are using same variable name every where. In form you you are using $_GET['myZip'] also. so make sure the variable names.

// Validate the Zip code:
if (is_numeric($_GET['myZipcode'])) { -<===== /Here you I replaced with myZipcod

   $myZip = $_GET['myZipcode']; -<===== /Here you need to replace with myZipcod

}