Calphoto Posted January 23, 2009 Share Posted January 23, 2009 Ok I am not even a newbie. I have some code that used to work and I did something to mess it up but can't figure it out How do I post it for someone to help me with? should I include it here as text? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/ Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 [ code] put ur code isnide tags (without the space) [ /code] Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744486 Share on other sites More sharing options...
rhodesa Posted January 23, 2009 Share Posted January 23, 2009 post the relevant code, any errors that are produced, and what the output is (both expected and actual) Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744487 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 Here is the Html <html> <head> <title>JBA Home Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <link rel="stylesheet" href="/JBA.css" type="text/css"> <script language="JavaScript"> <!-- <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); // --> //--> </script> </head> <body bgcolor="#465B68" text="#000000" onLoad="MM_preloadImages('/Images/Faqroll_15.jpg','/Images/Exroll_17.jpg','/Images/Servroll_13.jpg','/Images/Optionroll_16.jpg','/Images/Contactroll_14.jpg')"> <form action="feedback.php" method="post"> <div align="center"> <table width="720" border="0" cellspacing="0" cellpadding="0" height="1" align="center" summary="feedback form"> <tr> <td width="18" height="18" valign="top"><img src="/Images/Gray-Corner.jpg" width="18" height="18"></td> <td valign="top" colspan="8"><img src="/Images/Page2_02.jpg" width="684" height="18"></td> <td width="18" valign="top"><img src="/Images/gray-corn2.jpg" width="18" height="18"></td> </tr> <tr> <td height="125" valign="top" width="18"><img src="/Images/Page2_04.jpg" width="18" height="125"></td> <td valign="top" colspan="8"><img src="/Images/Page2_05.jpg" width="684" height="125"></td> <td valign="top" width="18"><img src="/Images/Page2_06.jpg" width="18" height="125"></td> </tr> <tr> <td height="28" valign="top" width="18"><img src="/Images/Page2_07.jpg" width="18" height="28"></td> <td width="135" valign="top"><img src="/Images/Bar.jpg" width="135" height="28"></td> <td width="55" valign="top"><img src="/Images/Hometab.jpg" width="55" height="28"></td> <td width="67" valign="top"><a href="/services.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image24','','/Images/Servroll_13.jpg',1)"><img name="Image24" border="0" src="/Images/Page2_10.jpg" width="67" height="28"></a></td> <td width="78" valign="top"><a href="/contactus.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image19','','/Images/Contactroll_14.jpg',1)"><img name="Image19" border="0" src="/Images/Page2_11.jpg" width="78" height="28"></a></td> <td width="52" valign="top"><a href="/faqs.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','/Images/Faqroll_15.jpg',1)"><img name="Image21" border="0" src="/Images/Page2_12.jpg" width="52" height="28"></a></td> <td width="90" valign="top"><a href="/options.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image22','','/Images/Optionroll_16.jpg',1)"><img name="Image22" border="0" src="/Images/Page2_13.jpg" width="90" height="28"></a></td> <td width="72" valign="top"><a href="/examples.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image23','','/Images/Exroll_17.jpg',1)"><img name="Image23" border="0" src="/Images/Page2_14.jpg" width="72" height="28"></a></td> <td width="135"><img src="/Images/bar2.jpg" width="135" height="28"></td> <td valign="top" width="18"><img src="/Images/Page2_16.jpg" width="18" height="28"></td> </tr> <tr> <td height="877" valign="top" background="/Images/Page2_18.jpg" width="18"> </td> <td colspan="8" valign="top" bgcolor="#FFFFFF" height="877"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="right" height="898"> <tr> <td width="46%" rowspan="2"> <blockquote> <h1><b><font face="Trajan Pro"><i><font color="#000099"> APPLY NOW</font></i></font></b></h1> </blockquote> </td> <td colspan="2" valign="bottom"> </td> </tr> <tr> <td width="26%" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2">Full Name:</font></td> <td width="28%" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2">E-Mail:</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="name2" id="tswname"> </font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" id="tswemail" name="email2"> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">Address:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">City:</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="street2" id="tswstreet"> </font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="city2" id="tswcity"> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">State:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Zip:</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"> <font face="Arial, Helvetica, sans-serif" size="2"> <select name="select" id="tswstate"> <option value="U.S. State" selected>U.S. State</option> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> </font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="zip2" id="tswzip" size="10" /> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><label for="tswphne"><font face="Arial, Helvetica, sans-serif" size="2">Phone:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Cell Phone:</font></td> </tr> <tr> <td valign="top" width="46%"> </td> <td valign="top" width="26%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="phne2" id="tswphne"> </font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="cell2" id="tswcell"> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"> </td> <td width="28%"> </td> </tr> <tr> <td width="46%"> </td> <td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2">When is the best time to contact: <select name="select" id="tswcall"> <option value="Occupancy"></option> <option value="Mornings">Mornings</option> <option value="Afternoons">Afternoons</option> <option value="Evenings">Evenings</option> </select> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"> </td> <td width="28%"> </td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">1st Loan Amount:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"> Current Status</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif"> <input name="loanbal3" id="tswloanbal" type="text"> </font><font face="Arial, Helvetica, sans-serif" size="2"></font></td> <td width="28%"> <select name="select" id="tswstatus1"> <option value="Loan Status" selected>Loan Status</option> <option value="1 Month Past Due">1 Month Past Due</option> <option value="2 Months Past Due">2 Months Past Due</option> <option value="3 Months Past Due">3+ Months Past Due</option> <option value="In Forclosure">In Forclosure</option> </select> </td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">Lender Name:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Loan Type</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="Lend12" id="tswlend1"> </font></td> <td width="28%"> <select name="select" id="tswtype1"> <option value="Loan Status" selected>Loan Type</option> <option value="Purchase">Purchase</option> <option value="Refinance">Refinance</option> </select> </td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">2nd Loan Amount:</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Current Status:</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif"> <input name="loanbal22" id="tswloanbal2" type="text"> </font><font face="Arial, Helvetica, sans-serif" size="2"></font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2"></font> <font face="Arial, Helvetica, sans-serif" size="2"> <select name="select" id="tswstatus2"> <option value="Loan Status" selected>Loan Status</option> <option value="1 Month Past Due">1 Month Past Due</option> <option value="2 Months Past Due">2 Months Past Due</option> <option value="3 Months Past Due">3+ Months Past Due</option> <option value="In Forclosure">In Forclosure</option> </select> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">Lender Name: </font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Loan Type</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="lend22" id="tswlend2"> </font></td> <td width="28%"> <font face="Arial, Helvetica, sans-serif" size="2"> <select name="select" id="tswtype2"> <option value="Loan Status" selected>Loan Type</option> <option value="Purchase">Purchase</option> <option value="Refinance">Refinance</option> </select> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"><font face="Arial, Helvetica, sans-serif" size="2">Employment</font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif" size="2">Occupancy</font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"> <font face="Arial, Helvetica, sans-serif" size="2"> <select name="select" id="tswempl"> <option value="Employment" selected>Employment</option> <option value="Full Time">Full Time</option> <option value="Part Time">Part Time</option> <option value="Retired">Retired</option> <option value="Disabled">Disabled</option> <option value="Spouse Employed">Spouse Employed</option> <option value="Un-Employed">Un-Employed</option> </select> </font></td> <td width="28%"> <font face="Arial, Helvetica, sans-serif" size="2"> <select name="select" id="tswocc"> <option value="Occupancy" selected>Occupancy</option> <option value="Primary">Primary</option> <option value="Secondary">Secondary</option> <option value="Investment">Investment</option> </select> </font></td> </tr> <tr> <td width="46%"> </td> <td width="26%"> </td> <td width="28%"> </td> </tr> <tr> <td colspan="3"> <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">Please briefly describe your situation and other comments</font></div> </td> </tr> <tr> <td colspan="3"> <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"> <textarea rows="15" cols="50" name="textarea" id="tswcomments" ></textarea> </font></div> </td> </tr> <tr valign="bottom"> <td colspan="3" height="20"> <div align="center"> <input type="submit" value="Submit Application" /> </div> </td> </tr> <tr valign="bottom"> <td colspan="3"> <p align="center"><font face="Trajan Pro"><b>Don't Delay!... Time is not on your side... <i><font size="6" color="#000099">APPLY NOW!</font></i></b></font></p> </td> </tr> </table> <h1> </h1> </td> <td valign="top" background="/Images/Page2_20.jpg" width="18" height="877"> </td> </tr> <tr> <td valign="top" height="19" width="18"><img src="/Images/Gray-corn3.jpg" width="18" height="18"></td> <td colspan="8" valign="top"><img src="/Images/Page2.2_27.jpg" width="684" height="18"></td> <td valign="top" width="18"><img src="/Images/Gray-corn4.jpg" width="18" height="18"></td> </tr> </table> </div> <div align="center"><font size="1"><br> ©Copyright DHS Computers 2008 </font></div> </form> </body> </html> and this is the PHP <?php $mailto = 'jbaapps@gmail.com' ; $subject = "Online Loan App" ; $formurl = "http://www.jbafinancialgroup.com/index.html" ; $errorurl = "http://www.jbafinancialgroup.com/error.html" ; $thankyouurl = "http://www.jbafinancialgroup.com/thankyou.html" ; $email_is_required = 1; $name_is_required = 1; $uself = 0; $use_envsender = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; // ------------------------------------------------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (!isset( $use_envsender )) { $use_envsender = 0 ; } $envsender = "-f$mailto" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $street = $_POST['street'] ; $city = $_POST['city'] ; $state = $_POST['state'] ; $zip = $_POST['zip'] ; $phne = $_POST['phne'] ; $cell = $_POST['cell'] ; $call = $_POST['call'] ; $loanbal = $_POST['loanbal'] ; $status1 = $_POST['status1'] ; $lend1 = $_POST['lend1'] ; $type1 = $_POST['type1'] ; $loanbal2 = $_POST['loanbal2'] ; $status2 = $_POST['status2'] ; $lend2 = $_POST['lender2'] ; $type2 = $_POST['type2'] ; $empl = $_POST['empl'] ; $occ = $_POST['occ'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Full Name: $name\n" . "Email: $email\n" . "Street: $street\n" . "City: $city\n" . "State: $state\n" . "Zip: $zip\n" . "Phone: $phne\n" . "Cell: $cell\n" . "Best Time: $call\n" . "------------------------- FIRST MORTGAGE ------------------------\n\n" . "Loan Balance: $loanbal\n" . "Loan Status: $status1\n" . "Lender: $lend1\n" . "Loan Type: $type1\n" . "------------------------- SECOND MORTGAGE ------------------------\n\n" . "Balance: $loanbal2\n" . "Status: $status2\n" . "Lender: $lend2\n" . "Loan Type: $type2\n" "----------------------- OTHER INFO -----------------------\n\n" . "Employment: $empl\n" . "Occupancy: $occ\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$name\" <$fromemail>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.13.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($use_envsender) { mail($mailto, $subject, $messageproper, $headers, $envsender ); } else { mail($mailto, $subject, $messageproper, $headers ); } header( "Location: $thankyouurl" ); exit ; ?> Sorry I don't know what is important and what could be left out Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744498 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 post the relevant code, any errors that are produced, and what the output is (both expected and actual) Any errors? What happens? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744500 Share on other sites More sharing options...
revraz Posted January 23, 2009 Share Posted January 23, 2009 Now say what you changed and where. State what the actual problem is. State any errrors. Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744501 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 1. when I hit submit without putting in the required info it does not go to the "error" page. 2. when I hit submit after putting in the required info it does not go to the "thank you" page 3. most importantly after posting I do not receive a post in the email it points to. as far as changes it was mostly graphical to the html but I did move the form fields within a div table. I also added some form fields to the html and added the coresponding code in the php to add it to the e-mail it creates I tried reverting back to previous working html pages but received the same issues. at one point when I first posted the change when I submitted it told me there was an error at line 91 Thanks for any help any of you can provide Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744522 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 What does it do when you hit the submit button, what shows on screen? does anything work? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744539 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 I reloads the same page with no error message when I submit... this site is up right now while I am trying to solve this, you can try it yourself Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744542 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 Link? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744543 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 http://www.jbafinancialgroup.com/ Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744547 Share on other sites More sharing options...
Philip Posted January 23, 2009 Share Posted January 23, 2009 On your form, the email field is named "email2" not "email", thus PHP will always return you back to the form because there is no "email". Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744553 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 Just looking at it briefly it seems that the code you have here is different to the code online. It always redirects to apply.html, a page that isn't mentioned in your code Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744555 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 it appears that many of my fields picked up a "2" at the end (i accidentally pasted the html a second time in the document) so I think removing it will be good... I am trying it ...Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744579 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 Ok I removed the additional "2" that was added to the fields and it now comes up with this error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/j/b/a/jbaadmin/html/feedback.php on line 91 Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744636 Share on other sites More sharing options...
Philip Posted January 23, 2009 Share Posted January 23, 2009 You're missing a period: "Lender: $lend2\n" . "Loan Type: $type2\n" "----------------------- OTHER INFO -----------------------\n\n" . Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744640 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 There was a string symbol in front of the comments line $comments . should it be "comments . instead Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744643 Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 If you have a syntax error, post your code with the error . I may write a tutorial on debugging soon, it's so simple yet not many people seem to realise its potential . Make sure to Echo, or Print_r (for arrays), all the variables you are using at different points in the script. This way you can make sure any if statements are working as they should etc. It can be a LOT quicker than waiting for someone here to reply - and you learn a lot really fast. I would also suggest wrapping your code up into sections or fuctions to make it easier to use/read. ex. use Switch() statements, use preg_match to sanitize any client data (to stop hacking attempts) etc. Without seeig the whole code responsible (probabl im guessing 3-4 php files), and downloadig them to my development machine, i would highly reccommend echoing the variables used in the if statements. Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744649 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 I don't know what 99% of what you said Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744675 Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 simply put: Echo all the variables in the script. one after another, before and after the are checked or used. You ca then see if it is what you expected. Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744677 Share on other sites More sharing options...
Calphoto Posted January 23, 2009 Author Share Posted January 23, 2009 I'm sorry I really am so new to this that I am lost... I can do the html part but PHP syntax has me at a loss I don't know what you mean by echo each variable etc... could you post an example of what you mean? Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744750 Share on other sites More sharing options...
uniflare Posted January 24, 2009 Share Posted January 24, 2009 I'll write up a little mini tut for you: (php freaks scroll to bottom) PHP Variables Variables are labels for data. The data can vary, and so, they are variable. Variables can be named with underscores and letters and numbers, but must not start with a number. PHP Functions Functions in php are the most important part, knowing what functions do what is very important - ou will not be able to understand php if you cannot understand what each function does. You can use http://www.php.net/ and use the "Function Search" box to lookup functions you don't know. Example; Echoing a Variable To echo a php variable, you must use the "echo" or "print" function (or similar); <?php // This is a comment, as such, ou can write what you want as long as you dont continue on a new line. // This sets the variable labeled "variable" (i know ryt ?), to the value: "Hello World!". $variable = "Hello World!"; // Function take arguments, either none, or several (as many as it needs), the echo variable only requires the data, so 1 argument ($variable), is passed. echo($variable); ?> The above will output: Hello World! Now you know how to echo a variable, you can start checking if the variables in your script are what you expect them to be. Prepare for Debugging: First, for debugging purposes, make it easy on your self and change these redirections: <?php if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } ?> <?php header( "Location: $thankyouurl" ); exit ; ?> to something like: <?php if (!isset($_POST['email'])) { // header( "Location: $formurl" ); exit "Email Missing"; } if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) { // header( "Location: $errorurl" ); exit "Email or Name Missing"; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { // header( "Location: $errorurl" ); exit "Name or email is on multiple lines, must be on a single line"; } ?> <?php // header( "Location: $thankyouurl" ); exit "Thank you, success"; ?> Now you can start playing with the variables so you can check they are what you want/need them to be. Start debugging your code (Trace the Problem to the Source) I would start off with this part: <?php if (!isset($_POST['email'])) { // header( "Location: $formurl" ); exit "Email Missing"; } ?> I would add "print_r($_POST);" like so: <?php print_r($_POST); if (!isset($_POST['email'])) { // header( "Location: $formurl" ); exit "Email Missing"; } ?> Notes: the print_r() function is useful for echoing arrays (the keys and values), like form data or get data ($_POST/$_GET/$_REQUEST). You can use print_r to first check if the form data is what it should be, if it isnt then you know that the problem is either the name of your input tags, or the names your using in the $_POST['name_here'] variables. If they check out fine, echo another variable, it's very simple, once you find the cause you can modify your script to either fix it or flat out change the method your using. == I hope this helps. To All PHP Freaks Reading This: (I am not providing a direct solution. If you have any ideas, or direct solutions for this persons problem, post them) Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-744903 Share on other sites More sharing options...
Calphoto Posted January 24, 2009 Author Share Posted January 24, 2009 Thank you all... especially uniflare, I am relearning web design and this helps After seeing the variables that had been changed by the copying of the file I simply went line by line including ones I didn't look at before asking for help, I assumed these were fine since I hadn't changed them and made sure all of the field names and labels were accurate. this fixed my issues Thanks again... and once I get to be a PHP monster I will help those that I can in return Quote Link to comment https://forums.phpfreaks.com/topic/142135-solved-it-used-to-work-help/#findComment-745152 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.