Jump to content

WebProgrammerNewb22

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by WebProgrammerNewb22

  1. any help would be appreciated.. even if you can just guide us in the right direction..
  2. Hey guys, i'm trying to help my buddy out with a contact database and we ran into a problem I was hoping you guys could help me out with. Everything is working except his update contact page. The error is the following, where do you think we should start in fixing this problem?? Error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 55 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 56 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 57 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 58 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 59 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 60 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 61 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/stofikj2/public_html/hw5/updcontact.php on line 62
  3. Hey guys.. I've been setting up a database for a contact page and I have everything working for it except the following error on my update contact page.. can anyone help me figure it out?? The error lines are the ones where I have my mysql_result's. Errors: No Records Found Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 103 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 104 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 105 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 106 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 107 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 108 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 109 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 110 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/jonnyp22/public_html/a5/update_contact.php on line 111 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Update Contact</title> <script type="text/javascript"> function Validateform(){ var email=document.form1.email; var firstname=document.form1.firstname; var lastname=document.form1.lastname; var state=document.form1.state; var reEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/; if ((email.value==null)||(email.value=="")){ alert("Please enter email address"); email.focus(); return false; } if (reEmail.test(email.value)==false){ alert ("Please enter valid email address"); email.focus(); return false; } if ((firstname.value=="")||(firstname.value==null)) { alert("Please enter first name"); firstname.focus(); return false; } if ((lastname.value=="")||(lastname.value==null)) { alert("Please enter last name"); lastname.focus(); return false; } if (state.selectedIndex==0) { alert("Select state"); state.focus(); return false; } return true; } </script> <style type="text/css"> .style1 { text-align: center; color: #F8B57E; font-size: x-large; } .style2 { text-align: center; } .style3 { text-align: right; color: #F8B57E; } .style4 { text-align: left; } .style6 { text-align: center; color: #F8B57E; font-size: medium; } .style7 { color: #FFFFFF; } </style> </head> <body style="color: #FFFFFF; background-color: #102541"> <div class="style2"> <p class="style1"><strong>Update Contact</strong></p> <p class="style6">* Indicates a Required Field</p> <?php include("dl.php"); // If the form has not been submitted then show it if(!$_POST['Submit']) { $email=$_GET['email']; $query="SELECT * FROM person WHERE Email = '$email'"; $result=mysql_query($query) or die('Error: ' . mysql_error()); $num=mysql_numrows($result); mysql_close(); if ($num == 0) { echo "<b><center>No Records Found</center></b>"; } $lastname=mysql_result($result,0,"Last_Name"); $email=mysql_result($result,0,"Email"); $firstname=mysql_result($result,0,"First_Name"); $address1=mysql_result($result,0,"address1"); $address2=mysql_result($result,0,"address2"); $city=mysql_result($result,0,"city"); $state=mysql_result($result,0,"state"); $zip=mysql_result($result,0,"zip"); $phone=mysql_result($result,0,"phone"); ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <table style="width: 100%"> <tr> <td style="width: 219px; height: 26px" valign="top" class="style3">E-mail Address:</td> <td style="height: 26px" class="style4"> <input name="email" style="width: 363px" type="text" value="<? echo $email; ?>" readonly="readonly" /> </td> </tr> <tr><td class="style3">First Name:</td><td class="style4"><input type="text" name="firstname" id="firstname" size="30" width="250px" value="<? echo $firstname; ?>"/></td></tr> <tr> <td class="style3" >Last Name:</td><td class="style4" ><input name="lastname" id="lastname" type="text" size="30" width="250px" value="<? echo $lastname; ?>"/></td> </tr> <tr><td class="style3">Phone:</td><td class="style4"><input type="text" name="phone" id="phone" size="15" width="250px" value="<? echo $phone; ?>"/></td></tr> <tr> <td class="style3">Address Line 1:</td><td class="style4"><input type="text" name="address1" id="address1" size="50" width="250px" value="<? echo $address1; ?>" /></td></tr> <tr> <td class="style3">Address Line 2:</td><td class="style4"><input type="text" name="address2" id="address2" size="50" width="250px" value="<? echo $address2; ?>"/></td></tr> <tr><td class="style3">City:</td><td class="style4"><input type="text" name="city" id="city" size="50" width="250px" value="<? echo $city; ?>"/></td></tr> <tr><td class="style3">State:</td><td class="style4"><select name="state" id="state"> <option <? if ($state=="NJ") echo selected ;?> >NJ</option> <option <? if ($state=="NY") echo selected ;?> >NY</option> </select></td></tr> <tr><td class="style3">Zip:</td><td class="style4"><input type="text" name="zip" id="zip" size="5" value="<? echo $zip; ?>"/></td></tr> </table> <p class="style2"><input name="Submit" type="submit" value="Update" /> <a href="show_contacts.php"><span class="style7">Show Contacts</span></a> <br /> </p> </form> <?php } else { // The form has been submitted so process it $email=$_POST['email']; $lastname=$_POST['lastname']; $firstname=$_POST['firstname']; $phone=$_POST['phone']; $address1=$_POST['address1']; $address2=$_POST['address2']; $city=$_POST['city']; $state=$_POST['state']; $zip=$_POST['zip']; $query="UPDATE person SET Last_Name='$lastname',FIRST_Name='$firstname',Phone='$phone', Address1='$address1', Address2='$address2', city='$city', state='$state',zip='$zip' WHERE Email='$email'"; if (!mysql_query($query,$con)) { die('Error: ' . mysql_error()); } else { echo "<center><b> Contact info $lastname updated successfully </b><a href='show_contacts.php'>show contacts</a></center>"; } mysql_close(); } ?> </div> </body> </html>
  4. OK great thanks for your help. I still think I want to use JavaScript only because that is the method that my professor prefers. This is for a class, but I also use this website for personal use for resume's and such. Does anyone know why my java is not working??
  5. That is correct. I am trying to use JavaScript to show my error messages and pop up boxes. To do this do I put the Java code right in my HTML page like I did above?? When I put the form I have to put an action, so I just made another page with the same code to make sure it was using it.
  6. what your referring to is where I put the form action?? I'm sorry I am very new to this and am trying to understand how to best switch it to Java.
  7. Hey guys. I made a contact form for my website originally in PHP. I wanted to change it to JavaScript because taht is the preferred way. I am new to this and was looking for some help. Originally I had the form in my HTML file using a seperate PHP file for error checking. For JavaScript do I have to make a seperate page and call to it like the last time?? I have put it all on my HTML page and where it was calling for the php page, I also put the JavaScript code. When I go to my site, the error checking is not working at all. There must be something wrong, but I haven't been able to point it out and I am very new to JavaScript. Also, when I go to my page and right click for the source code, the JavaScript I have in there does not show up. Below is my HTML code. I know my styles are sloppy and unorganized, sorry about that. Thanks for the help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Contact_Form</title> </head> <body> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Contact Me</title> <meta name="description" content="Ways to contact me"/> <style type="text/css"> .style2 { text-align: left; } .style3 { font-family: "Copperplate Gothic Bold"; font-size: xx-large; color: #F8B57E; } .style4 { font-size: xx-large; font-family: "Copperplate Gothic Bold"; letter-spacing: 6pt; color: #F8B57E; } .style5 { text-align: center; } .style6 { text-align: center; margin-top: 8px; } .style19 { color: #F8B57E; font-size: x-large; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style40 { text-decoration: none; } .style32 { color: #F8B57E; } .style37 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style51 { font-size: x-large; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style52 { text-align: right; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; color: #F8B57E; } .style53 { text-align: center; margin-top: 8px; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; font-size: x-large; color: #F8B57E; } .style54 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; color: #F8B57E; } </style> <meta content="Different ways to contact me" name="description" /> <script type="text/javascript" language="javascript"> //Following will validate the fields.When left blank it will pop up various messages. function emailcheck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid Email address") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid Email address") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid Email address") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid Email address") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid Email address") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid Email address") return false } if (str.indexOf(" ")!=-1){ alert("Invalid Email address") return false; } return true } function ValidateForm(){ var FirstName=document.MainForm.FirstNameTextBox var LastName=document.MainForm.LastNameTextBox var State=document.MainForm.StateDropDownBox var PhoneNumber=document.MainForm.PhoneNumberTextBox var EmailAddress=document.MainForm.EmailAddressTextBox if ((FirstName.value==null)||(FirstName.value=="")){ alert("Please enter your First Name.") firstname.focus() return false } if ((LastName.value==null)||(LastName.value=="")){ alert("Please enter your Last Name.") lastname.focus() return false } if (State.selectedIndex==0){ alert("Please select a State.") state.focus() return false } if ((PhoneNumber.value==null)||(PhoneNumber.value=="")){ alert("Please enter your Phone Number.") phone.focus() return false } if ((EmailAddress.value==null)||(EmailAddress.value=="")){ alert("Please enter a valid Email Address.") emailID.focus() return false } if (emailcheck(EmailAddress.value)==false){ EmailAddress.value="" EmailAddress.focus() return false } return true } </script> </head> <body style="color: #FFFFFF; background-color: #102541"> <div id="layer1" class="style2" style="position: relative; width: 1100px; height: 1375px; z-index: 1; margin-bottom: 50px; margin-left: auto; margin-right: auto; margin-top: 50px; border-style: solid; border-color: #F8B57E"> <p class="style5" style="height: 84px"> <br /> <br /> <span class="style4">Jonathan M. Palmieri</span></p> <hr class="style3" noshade="noshade" style="width: 85%; height: 4px; margin-bottom: 0px" /> <p class="style6" style="height: 34px; margin-top: 0px"> <a class="style40" href="index.html"> <span class="style19"> Home</span></a><span class="style19"> | <a class="style40" href="resume.html"><span class="style32">My Resume</span></a> | <a class="style40" href="HobbiesInterests.html"><span class="style32">Hobbies & Interests</span></a> | <a class="style40" href="WorkInterests.html"><span class="style32">Work Interests</span></a> | <a class="style40" href="CoursesTaken.html"> <span class="style32">Courses Taken</span></a> | </span> <span class="style51"> Contact Me</span></p> <p class="style6" style="height: 34px; margin-top: 0px"> </p> <p class="style53" style="height: 34px; margin-top: 0px"> Contact Me</p> <table style="width: 100%"> <tr> <td class="style5"> <form action="AddContact.php" method="get" name="MainForm"> <span class="style54">* Indicates a required field</span><br /> <table style="width: 100%"> <tr> <td class="style52" style="width: 504px">*First Name</td> <td class="style2"><input name="FirstNameTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">*Last Name</td> <td class="style2"><input name="LastNameTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">*Phone Number</td> <td class="style2"><input name="PhoneNumberTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">*Email Address</td> <td class="style2"><input name="EmailAddressTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">Address</td> <td class="style2"><input name="AddressTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">City</td> <td class="style2"><input name="CityTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">*State</td> <td class="style2"> <select name="StateDropDownBox" style="width: 73px"> <option></option> <option>NJ</option> <option>NY</option> <option>Other</option> </select></td> </tr> <tr> <td class="style52" style="width: 504px">Zip</td> <td class="style2"> <input name="ZipTextBox" type="text" style="width: 74px" /></td> </tr> </table> <input name="SubmitButton" type="submit" value="Submit" /><br /> <br /> <br /> <br /> </form> </td> </tr> <tr> <td> </td> </tr> </table> <p> <span class="style32"><span class="style37"> </span></span></p> <p> </p> <p> </p> <p> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"><span class="style32"><span class="style37">Privacy Policy | Terms of Use | Contact Me</span><br class="style37" /> <span class="style37"> Website Designed and Developed by Jonathan Palmieri</span><br class="style37" /> <br class="style37" /> <span class="style37"> Copyright © 2010</span></span></p> </div> </body> </html></body> </html>
  8. I did change the variables to match mine.. what else am i doing wrong?
  9. <?php ini_set('display_errors', '0'); //Define Variables. $FirstName = $_GET['FirstNameTextBox']; $LastName = $_GET['LastNameTextBox']; $PhoneNumber = $_GET['PhoneNumberTextBox']; $EmailAddress = $_GET['EmailAddressTextBox']; $Address = $_GET['AddressTextBox']; $City = $_GET['CityTextBox']; $State = $_GET['StateDropDownBox']; $Zip = $_GET['ZipTextBox']; $error1='*Please enter a First Name<br>'; $error2='*Please enter a Last Name<br>'; $error3='*Please enter a Phone Number<br>'; $error4='*Please choose a state<br>'; $error5='*Please enter a valid email address<br>'; $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); $day3 = mktime(0,0,0,date("m"),date("d")+3,date("Y")); $day7 = mktime(0,0,0,date("m"),date("d")+7,date("Y")); // Array to collect messages $messages = array(); //Display errors. if($FirstName=="") {$messages[] = $error1; } if($LastName=="") {$messages[] = $error2; } if($PhoneNumber=="") {$messages[] = $error3; } if($State=="") {$messages[] = $error4; } if($EmailAddress=="") {$messages[] = $error5; } //validate email address if ( filter_var($_POST['EmailAddress'], FILTER_VALIDATE_EMAIL) === false ) { $errors[] = 'The email address you have entered is not valid.'; } else { $email = $_POST['email']; } // Don't do this part unless we have no errors if (empty($messages)) { //Display correct contact date. if($State == "NY") { $messages[] = "Hello $FirstName $LastName! Thank you for contacting me. I will get back to you within 2 days, before " .date("d M Y", $day2); } if($State == "NJ") { $messages[] = "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 3 days, before " .date("d M Y", $day3); } if($State == "Other") { $messages[] = "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 1 week, before " .date("d M Y", $day7); } } // END if empty($messages echo implode('<BR>', $messages); ?> <p>--<a href="Contact_Form.html" class="style2"><span class="style1">Go Back</span></a>--</p> </body> </html>
  10. I tried it on my page and am still getting thru without a valid email address..
  11. Hey guys.. I'm completely done with my contact form data validation except I cannot seem to get one part. For my email field I need to make sure that it is a valid email address and not just words. Also, I would like to make the phone number specific length. Any ideas on how to go about this? thanks guys! <?php ini_set('display_errors', '0'); //Define Variables. $FirstName = $_GET['FirstNameTextBox']; $LastName = $_GET['LastNameTextBox']; $PhoneNumber = $_GET['PhoneNumberTextBox']; $EmailAddress = $_GET['EmailAddressTextBox']; $Address = $_GET['AddressTextBox']; $City = $_GET['CityTextBox']; $State = $_GET['StateDropDownBox']; $Zip = $_GET['ZipTextBox']; $error1='*Please enter a First Name<br>'; $error2='*Please enter a Last Name<br>'; $error3='*Please enter a Phone Number<br>'; $error4='*Please choose a state<br>'; $error5='*Please enter a valid email address<br>'; $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); $day3 = mktime(0,0,0,date("m"),date("d")+3,date("Y")); $day7 = mktime(0,0,0,date("m"),date("d")+7,date("Y")); // Array to collect messages $messages = array(); //Display errors. if($FirstName=="") {$messages[] = $error1; } if($LastName=="") {$messages[] = $error2; } if($PhoneNumber=="") {$messages[] = $error3; } if($State=="") {$messages[] = $error4; } if($EmailAddress=="") {$messages[] = $error5; } // Don't do this part unless we have no errors if (empty($messages)) { //Display correct contact date. if($State == "NY") { $messages[] = "Hello $FirstName $LastName! Thank you for contacting me. I will get back to you within 2 days, before " .date("d M Y", $day2); } if($State == "NJ") { $messages[] = "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 3 days, before " .date("d M Y", $day3); } if($State == "Other") { $messages[] = "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 1 week, before " .date("d M Y", $day7); } } // END if empty($messages echo implode('<BR>', $messages); ?> <p>--<a href="Contact_Form.html" class="style2"><span class="style1">Go Back</span></a>--</p> </body> </html>
  12. Thanks a lot man! That worked perfectly! Any idea how to make sure that the email address is a valid email address?? Also, I think I need to make sure the phone number is an actual phone number. What would be the PHP for this validation? Thanks again
  13. it did not work wihtout the exits.. is there anyway to get rid of them and make it work?? i really would like the return home at the bottom.. thanks for the help!
  14. The html is for the actual contact form. That page works fine. I just threw that code in as well. The php page is the problem. The only thing I cannot get to show up is that return home link at the bottom. It just shows up with the error messag and the user has to hit back.
  15. Hey guys, I know this is probably a real stupid error, but I've been looking at it for a while and was looking for some advice. I can't figure out why my return home link isn't showing up on my html page. I am making a contact form and have completed my error checking using php. Everything is working except the html for the return home link. I think its because the html openings and closings are out of wack, but i I tried changing it and it gave me an error. Thanks for the help! <body style="color: #F9B984; background-color: #102541"> PHP page: <?php ini_set('display_errors', '0'); //Define Variables. $FirstName = $_GET['FirstNameTextBox']; $LastName = $_GET['LastNameTextBox']; $PhoneNumber = $_GET['PhoneNumberTextBox']; $EmailAddress = $_GET['EmailAddressTextBox']; $Address = $_GET['AddressTextBox']; $City = $_GET['CityTextBox']; $State = $_GET['StateDropDownBox']; $Zip = $_GET['ZipTextBox']; $error1='*Please enter a First Name<br>'; $error2='*Please enter a Last Name<br>'; $error3='*Please enter a Phone Number<br>'; $error4='*Please choose a state<br>'; $error5='*Please enter a valid email address<br>'; $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); $day3 = mktime(0,0,0,date("m"),date("d")+3,date("Y")); $day7 = mktime(0,0,0,date("m"),date("d")+7,date("Y")); //Display errors. if($FirstName=="") {echo $error1; exit;} if($LastName=="") {echo $error2; exit;} if($PhoneNumber=="") {echo $error3; exit;} if($State=="") {echo $error4; exit;} if($EmailAddress=="") {echo $error5; exit;} //Display correct contact date. if($State == "NY") { echo "Hello $FirstName $LastName! Thank you for contacting me. I will get back to you within 2 days, before " .date("d M Y", $day2); exit; } if($State == "NJ") { echo "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 3 days, before " .date("d M Y", $day3); exit; } if($State == "Other") { echo "$Hello FirstName $LastName! Thank you for contacting me. I will get back to you within 1 week, before " .date("d M Y", $day7); exit; } ?> <p><a href="index.htm"><span class="style1">Return Home</span></a></p> </body> </html> HTML code (even though its probably not needed): <body> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Contact Me</title> <meta name="description" content="Ways to contact me"/> <style type="text/css"> .style2 { text-align: left; } .style3 { font-family: "Copperplate Gothic Bold"; font-size: xx-large; color: #F8B57E; } .style4 { font-size: xx-large; font-family: "Copperplate Gothic Bold"; letter-spacing: 6pt; color: #F8B57E; } .style5 { text-align: center; } .style6 { text-align: center; margin-top: 8px; } .style19 { color: #F8B57E; font-size: x-large; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style40 { text-decoration: none; } .style32 { color: #F8B57E; } .style37 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style51 { font-size: x-large; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } .style52 { text-align: right; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; color: #F8B57E; } .style53 { text-align: center; margin-top: 8px; font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; font-size: x-large; color: #F8B57E; } .style54 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; color: #F8B57E; } </style> <meta content="Different ways to contact me" name="description" /> </head> <body style="color: #FFFFFF; background-color: #102541"> <div id="layer1" class="style2" style="position: relative; width: 1100px; height: 1375px; z-index: 1; margin-bottom: 50px; margin-left: auto; margin-right: auto; margin-top: 50px; border-style: solid; border-color: #F8B57E"> <p class="style5" style="height: 84px"> <br /> <br /> <span class="style4">Jonathan M. Palmieri</span></p> <hr class="style3" noshade="noshade" style="width: 85%; height: 4px; margin-bottom: 0px" /> <p class="style6" style="height: 34px; margin-top: 0px"> <a class="style40" href="index.html"> <span class="style19"> Home</span></a><span class="style19"> | <a class="style40" href="resume.html"><span class="style32">My Resume</span></a> | <a class="style40" href="HobbiesInterests.html"><span class="style32">Hobbies & Interests</span></a> | <a class="style40" href="WorkInterests.html"><span class="style32">Work Interests</span></a> | <a class="style40" href="CoursesTaken.html"> <span class="style32">Courses Taken</span></a> | </span> <span class="style51"> Contact Me</span></p> <p class="style6" style="height: 34px; margin-top: 0px"> </p> <p class="style53" style="height: 34px; margin-top: 0px"> Contact Me</p> <table style="width: 100%"> <tr> <td class="style5"> <form action="AddContact.php" method="get"> <span class="style54">* Indicates a required field</span><br /> <table style="width: 100%"> <tr> <td class="style52" style="width: 504px">First Name</td> <td class="style2"><input name="FirstNameTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">Last Name</td> <td class="style2"><input name="LastNameTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">Phone Number</td> <td class="style2"><input name="PhoneNumberTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">Email Address</td> <td class="style2"><input name="EmailAddressTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">Address</td> <td class="style2"><input name="AddressTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">City</td> <td class="style2"><input name="CityTextBox" type="text" /></td> </tr> <tr> <td class="style52" style="width: 504px">State</td> <td class="style2"><select name="StateDropDownBox"> <option>NJ</option> <option>NY</option> <option>Other</option> </select></td> </tr> <tr> <td class="style52" style="width: 504px">Zip</td> <td class="style2"><input name="ZipTextBox" type="text" /></td> </tr> </table> <input name="SubmitButton" type="submit" value="Submit" /><br /> <br /> <br /> <br /> </form> </td> </tr> <tr> <td> </td> </tr> </table> <p> <span class="style32"><span class="style37"> </span></span></p> <p> </p> <p> </p> <p> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"> </p> <p class="style5"><span class="style32"><span class="style37">Privacy Policy | Terms of Use | Contact Me</span><br class="style37" /> <span class="style37"> Website Designed and Developed by Jonathan Palmieri</span><br class="style37" /> <br class="style37" /> <span class="style37"> Copyright © 2010</span></span></p> </div> </body> </html></body> </html>
  16. I'm sorry for not being clear as to what I have to do.. I need error checking that checks for data type, size, and basic format. Required fields are First Name, Last Name, Phone, State, and email. So I would replace the code that you mentioned with the required fields only correct?
  17. would i replace that in my define veriables section? or in my if echo statements.. im still confused to how my errors will show up
  18. I guess I will just use the isset() .. will that register my errors though? I don't see where in that it says if empty, give this error message..
  19. Hey guys.. I'm new to the forum and have a quick question about some coding i've been doing for my website. A couple index errors are coming up when I run my code, but I believe it all should be working fine. I am going to paste the code, but also upload the files so that you can understand the problem better. ANY help is greatly appreciated. I am currently making a contact form with validation. I know that using ifempty() is probably the best way, but I am unclear as to how to use it. I have two files, an html containing my form, and a php file containing the following code: //Define Variables $FirstName = $_GET['FirstNameTextBox']; $LastName = $_GET['LastNameTextBox']; $PhoneNumber = $_GET['PhoneNumberTextBox']; $EmailAddress = $_GET['EmailAddressTextBox']; $Address = $_GET['AddressTextBox']; $City = $_GET['CityTextBox']; $State = $_GET['StateDropDownBox']; $Zip = $_GET['ZipTextBox']; $error1='*Please enter a First Name<br>'; $error2='*Please enter a Last Name<br>'; $error3='*Please enter a Phone Number<br>'; $error4='*Please choose a state<br>'; $error5='*Please enter a valid email address<br>'; $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); $day3 = mktime(0,0,0,date("m"),date("d")+3,date("Y")); $day7 = mktime(0,0,0,date("m"),date("d")+7,date("Y")); if($FirstName=="") {echo $error1; exit;} if($LastName=="") {echo $error2; exit;} if($PhoneNumber=="") {echo $error3; exit;} if($State=="") {echo $error4; exit;} if($EmailAddress=="") {echo $error5; exit;} if($State == "NY") { echo "$FirstName $LastName - we will get back to you within 2 days, ie before " .date("d M Y", $day2); exit; } if($State == "NJ") { echo "$FirstName $LastName - we will get back to you within 3 days, ie before " .date("d M Y", $day3); exit; } if($State == "Other") { echo "$FirstName $LastName - we will get back to you within 1 week, ie before " .date("d M Y", $day7); exit; } The following errors come up: Notice: Undefined index: FirstNameTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 14 Notice: Undefined index: LastNameTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 15 Notice: Undefined index: PhoneNumberTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 16 Notice: Undefined index: EmailAddressTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 17 Notice: Undefined index: AddressTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 18 Notice: Undefined index: CityTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 19 Notice: Undefined index: StateDropDownBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 20 Notice: Undefined index: ZipTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 21 *Please enter a First Name Again, ANY help is greatly appreciated.. it is for a class, but I have honestly exhasted all my sources to figure out what is wrong. Are my codes correct and all there? Thanks for the help! -WPN [attachment deleted by admin]
  20. sorry for being so new at this.. but can you help me fix that? the variables are used and also on my contact form
  21. I have made two pages. One called AddContact.php and once called ContactForm.html. The html page contains the actual form and the action is set to AddContact.php where I have the code I pasted above. I have uploaded the two files to see if anyone can help me figure out what is wrong with the code and/or how to get it to work. It could possibly be my php configurations on my computer. Any help is greatly appreciated! [attachment deleted by admin]
  22. I have heard that ifempty is better to use, but I am not familiar with it. Here is another effort.. I have tried just declaring a bunch of variables and doing it the long way.. it may look like a lot of work but it makes the most sense to me (a newb) However, when I click on submit, a blank page comes up with the extension AddContact.php. I explained my set up in the previous post. Is there a reason for this because I know it is not with my code. Errors or something should at least come up but not a blank page. New Code: //Define Variables $FirstName = $_POST['FirstNameTextBox']; $LastName = $_POST['LastNameTextBox']; $PhoneNumber = $_POST['PhoneNumberTextBox']; $EmailAddress = $_POST['EmailAddressTextBox']; $Address = $_POST['AddressTextBox']; $City = $_POST['CityTextBox']; $State = $_POST['StateDropDownBox']; $Zip = $_POST['ZipTextBox']; $error1='*Please enter a First Name<br>'; $error2='*Please enter a Last Name<br>'; $error3='*Please enter a Phone Number<br>'; $error4='*Please choose a state<br>'; $error5='*Please enter a valid email address<br>'; $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); $day3 = mktime(0,0,0,date("m"),date("d")+3,date("Y")); $day7 = mktime(0,0,0,date("m"),date("d")+7,date("Y")); if($FirstName=="") {echo $error1; exit;} if($LastName=="") {echo $error2; exit;} if($PhoneNumber=="") {echo $error3; exit;} if($State=="") {echo $error4; exit;} if($EmailAddress=="") {echo $error5; exit;} if($State == "NY") { echo "$FirstName $LastName - we will get back to you within 2 days, ie before " .date("d M Y", $day2); exit; } if($State == "NJ") { echo "$FirstName $LastName - we will get back to you within 3 days, ie before " .date("d M Y", $day3); exit; } if($State == "Other") { echo "$FirstName $LastName - we will get back to you within 1 week, ie before " .date("d M Y", $day7); exit; } when I am in my program (expression web) I hit f12 to preview and a page does come up with errors for my .php page... the contactform.html page comes up correctly with my form on it, but again when I click submit on that page it goes to a blank page The errors are as followed for my .php page: Notice: Undefined index: FirstNameTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 14 Notice: Undefined index: LastNameTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 15 Notice: Undefined index: PhoneNumberTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 16 Notice: Undefined index: EmailAddressTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 17 Notice: Undefined index: AddressTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 18 Notice: Undefined index: CityTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 19 Notice: Undefined index: StateDropDownBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 20 Notice: Undefined index: ZipTextBox in C:\Users\Jonny P\Documents\My Web Sites\JMPMySite\AddContact.php on line 21 *Please enter a First Name
  23. Hey guys.. I've been making a contact form and doing the error checking. Usually this is not a problem in any other language besides php. However, it is mandatory that I use php for this. I am very good at .NET and such, but have not used much php. I am using post method and trying to do error checking for null fields. I used java and got it all to work but am having trouble putting it into php. My variables are as follows: //Define Variables $FirstName = $_POST['FirstNameTextBox']; $LastName = $_POST['LastNameTextBox']; $PhoneNumber = $_POST['PhoneNumberTextBox']; $EmailAddress = $_POST['EmailAddressTextBox']; $Address = $_POST['AddressTextBox']; $City = $_POST['CityTextBox']; $State = $_POST['StateDropDownBox']; $Zip = $_POST['ZipTextBox']; I was planning on using if else statements. For example: if(isempty($_POST['FirstNameTextBox'])) { // error } elseif($_POST['LastNameTextBox'])) //error } elseif($_POST['PhoneNumberTextBox'])) //error and so on.. I am also unsure of the actual code for the error message.. Am I correct in using this approach?? As you can see all my code is pretty much vb language. I've been researching this for a while and can not figure out the most simple way to do this using these statements. Any help you professionals can lend to a beginner is appreciated greatly!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.