![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I'm not sure why this isn't working, but it's giving me no output. I have a form which requests email and city to pull up a listing, then Email that address with their password. I'm doing an extract($_POST) to get the data from the previous form. When I test it I enter a known invalid email/city combination, yet I get a blank area where the first message should be. This is what's not working: include('dbconnect.php'); if (Submit == "Remind Me") { $query="SELECT ID,firstname,city,email,passwd from artists WHERE email='$email' AND city='$city'"; $result=mysql_query($query) or die(mysql_error("Could not execute query.")); // verify that the Email/city combination exists if (mysql_num_rows($result) < 1) { echo "<P> </P> We cannot find that Email address and city combination in our database. Please use your browser's \"Back\" button and check your entry.<BR> For best results, cut and paste the information from your listing to ensure that you don't have any typographical errors. If you continue to have difficulties, please <A HREF=\"mailto:Webmaster@domain.com\"> Email the Webmaster</A>.<BR>"; //break 2; (commented out in case it was causing the problem) } else { // pull listing from database while($row = mysql_fetch_array($result)) { $artistID = $row['artistID']; $firstname = $row['firstname']; $city= $row['city']; $email = $row['email']; $passwd = $row['passwd']; // generate Email $headers .= "From: Webmaster <Webmaster@domain.com>\n"; $headers .= "To: $firstname <$email>\n"; $headers .= "X-Sender: <Webmaster@domain.com>\n"; $headers .= "X-Mailer: domain.com\n"; //mailer $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal $headers .= "Return-Path: <Webmaster@domain.com>\n"; //Uncomment this to send html format $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; $message = " ...message text is here... mail($to......); } | |||
| Advertisements |
| | #2 | ||
| On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@hotmail.com> wrote: >I'm not sure why this isn't working, but it's giving me no output. > > if (Submit == "Remind Me") { If you'd had error_reporting turned up high enough, you'd have got a warning similar to: Use of undefined constant Submit, assuming string 'Submit'. Since 'Submit' != "Remind Me", only the 'else' branch would ever execute. > } else { > // pull listing from database > while($row = mysql_fetch_array($result)) { But $result was only defined inside the other branch of the if; surely it's undefined here. -- Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space) | |||
| | #3 | ||
| "Andy Hassall" <andy@andyh.co.uk> wrote in message news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com... > On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@hotmail.com> wrote: > > >I'm not sure why this isn't working, but it's giving me no output. > > > > if (Submit == "Remind Me") { > > If you'd had error_reporting turned up high enough, you'd have got a warning > similar to: > > Use of undefined constant Submit, assuming string 'Submit'. > > Since 'Submit' != "Remind Me", only the 'else' branch would ever execute. > The form that submits the data to this page has a value of "Remind Me" on the submit button. I was trying to verify that the data I was dealing with was submitted from that form. If they clicked the submit button on the first page, this SHOULD be true -- it works with all my other sites. > > } else { > > // pull listing from database > > while($row = mysql_fetch_array($result)) { > > But $result was only defined inside the other branch of the if; surely it's > undefined here. > True -- maybe I could copy the query down...? but that shouldn't be necessary if the data is coming from the submitted form, right? Wm | |||
| | #4 | ||
| On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LAshooter@hotmail.com> wrote: >"Andy Hassall" <andy@andyh.co.uk> wrote in message >news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com.. . >> On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@hotmail.com> wrote: >> >> >I'm not sure why this isn't working, but it's giving me no output. >> > >> > if (Submit == "Remind Me") { >> >> If you'd had error_reporting turned up high enough, you'd have got a >warning >> similar to: >> >> Use of undefined constant Submit, assuming string 'Submit'. >> >> Since 'Submit' != "Remind Me", only the 'else' branch would ever execute. >> > >The form that submits the data to this page has a value of "Remind Me" on >the submit button. I was trying to verify that the data I was dealing with >was submitted from that form. If they clicked the submit button on the first >page, this SHOULD be true -- it works with all my other sites. No, read it again. You've missed the $. >> > } else { >> > // pull listing from database >> > while($row = mysql_fetch_array($result)) { >> >> But $result was only defined inside the other branch of the if; surely >it's >> undefined here. > >True -- maybe I could copy the query down...? but that shouldn't be >necessary if the data is coming from the submitted form, right? Don't know, depends what you're passing. But it sounds like you need to put error_reporting to E_ALL as both of these should have displayed visible warnings. -- Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space) | |||
| | #5 | ||
| On 10-Aug-2003, "Wm" <LAshooter@hotmail.com> wrote: > "Andy Hassall" <andy@andyh.co.uk> wrote in message > news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com... > > On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@hotmail.com> wrote: > > > > >I'm not sure why this isn't working, but it's giving me no output. > > > > > > if (Submit == "Remind Me") { > > > > If you'd had error_reporting turned up high enough, you'd have got a > warning > > similar to: > > > > Use of undefined constant Submit, assuming string 'Submit'. > > > > Since 'Submit' != "Remind Me", only the 'else' branch would ever > > execute. > > > > The form that submits the data to this page has a value of "Remind Me" on > the submit button. I was trying to verify that the data I was dealing with > was submitted from that form. If they clicked the submit button on the > first > page, this SHOULD be true -- it works with all my other sites. Andy was trying to tell you that if (Submit should be if ($Submit -- Tom Thackrey www.creative-light.com | |||
| | #6 | ||
| That was it -- ok, note to self: don't work anymore without coffee. THANK YOU guys!!! Wm "Andy Hassall" <andy@andyh.co.uk> wrote in message news:uq4djv08aa3m9h28inci9nm2i3uoq35e4t@4ax.com... > On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LAshooter@hotmail.com> wrote: > > >"Andy Hassall" <andy@andyh.co.uk> wrote in message > >news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com.. . > >> On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@hotmail.com> wrote: > >> > >> >I'm not sure why this isn't working, but it's giving me no output. > >> > > >> > if (Submit == "Remind Me") { > >> > >> If you'd had error_reporting turned up high enough, you'd have got a > >warning > >> similar to: > >> > >> Use of undefined constant Submit, assuming string 'Submit'. > >> > >> Since 'Submit' != "Remind Me", only the 'else' branch would ever execute. > >> > > > >The form that submits the data to this page has a value of "Remind Me" on > >the submit button. I was trying to verify that the data I was dealing with > >was submitted from that form. If they clicked the submit button on the first > >page, this SHOULD be true -- it works with all my other sites. > > No, read it again. You've missed the $. > > >> > } else { > >> > // pull listing from database > >> > while($row = mysql_fetch_array($result)) { > >> > >> But $result was only defined inside the other branch of the if; surely > >it's > >> undefined here. > > > >True -- maybe I could copy the query down...? but that shouldn't be > >necessary if the data is coming from the submitted form, right? > > Don't know, depends what you're passing. > > But it sounds like you need to put error_reporting to E_ALL as both of these > should have displayed visible warnings. > > -- > Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk) > Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space) | |||
| Featured Websites | ||||
|
![]() |
| Tags: data, php, problem, retrieving |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| retrieving gps data from palmpilot | Mike | GPS | 0 | 06-25-2007 11:44 PM |
| Please help - Cracking elevation data format in data file | Kevin Fishburne | Software Programming | 10 | 06-12-2007 11:31 PM |
| cvs: pear /PEAR_Frontend_Web pearfrontendweb.php /PEAR_Frontend_Web/Frontend Web.php /PEAR_Frontend_Web/data style.css /PEAR_Frontend_Web/data/templates top.inc.tpl.html /PEAR_Frontend_Web/docs example.php index.php.txt | Pear | 0 | 05-27-2007 7:46 PM | |
| cvs: pear /PEAR_Frontend_Web/Frontend/Web/data package.js style.css /PEAR_Frontend_Web/Frontend/Web/data/images category.jpg config.gif download.gif error.gif info.gif infoplus.gif install.gif install_fail.gif install_ok.gif install_wait.gif login.g | Pear | 0 | 05-20-2007 7:42 PM | |
| Featured Websites | ||||
|