This is a discussion on code doesn't process within the alt.comp.lang.php forums, part of the PHP Programming Forums category; same problem before but this time I am putting in alerts, echos, and exit() When I hit the submit button ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
same problem before but this time I am putting in alerts, echos, and exit()
When I hit the submit button the page reloads and comes up as a blank page, no content. Have I called the form correctly? None of it is being processed. How is that possible? I have put in echo statements and exits statements but nothing... The form: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <div align="center"><input type="submit" name="Submit" value="Add New User" /></div> </form> the code: <?php if (isset($_POST['Submit'])) { $userID = (int)$_GET['id'];// if you don't use quotes in your sql you must cast the input $secureID = (int)$_GET['code']; if (!get_magic_quotes_gpc()) { $userID = addslashes($_GET['id']); } $check = mysql_query("SELECT * FROM user WHERE id = $userID")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die(mysql_error()); } while($info = mysql_fetch_array( $check )){ $dbSecureID = stripslashes($info[secureID]); $fName = stripslashes($info['fName']); $lName = stripslashes($info['lName']); //gives error if the password is wrong } // check out this code! $userName=''; if(!$userName = "$fName $lName"){ die("no value"); }else{ echo "hello world"; exit(); } // it never processes, what gives?? // then my email form is never sent // is there something wrong with the form submittion? if ($secureID != $dbSecureID) { die('This user has not registered yet!'); } else{ mysql_query("UPDATE user SET confirmIDFlag=1 WHERE id=$userID")or die(mysql_error()); require("php/class.phpmailer.php"); $mail = new PHPMailer(); // set mailer to use SMTP $mail->Host = "relay-hosting.secureserver.net"; $mail->From = "sermon8or@1purpose-bethel.org"; $mail->FromName = "Pastor Art Gorman"; $mail->AddAddress("kraleigh@sbcglobal.net", "$userName"); $mail->WordWrap = 50; $mail->IsHTML(true); // set email format to HTML $mail->Subject = "Welcome $userName"; $mail->Body = "This email is to inform $userName<br/> that you have been added to our mailing list"; $mail->AltBody = "This email is to inform $userName<br/> that you have been added to our mailing list"; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } } ?> <html><body><h1>Hello world</h1></body></html> <?php }else{ my html forms page... <?php } ?> insight always appreciated thank you Kevin Raleigh |
|
|||
|
"Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message news:8ICdneW5pJsQhwDbnZ2dnUVZ_veinZ2d@giganews.com ... > same problem before but this time I am putting in alerts, echos, and exit() > When I hit the submit button the page reloads and comes up as a blank page, > no content. > > Have I called the form correctly? > > > None of it is being processed. How is that possible? I have put in echo > statements and exits > statements but nothing... > > > The form: > <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> > <div align="center"><input type="submit" name="Submit" value="Add > New User" /></div> > </form> > > the code: > <?php > if (isset($_POST['Submit'])) { > $userID = (int)$_GET['id'];// if you don't use quotes in your sql you must > cast the input > $secureID = (int)$_GET['code']; > > if (!get_magic_quotes_gpc()) { > $userID = addslashes($_GET['id']); > } > > $check = mysql_query("SELECT * FROM user WHERE id = $userID")or > die(mysql_error()); > > > //Gives error if user dosen't exist > $check2 = mysql_num_rows($check); > if ($check2 == 0) { > die(mysql_error()); > } > > while($info = mysql_fetch_array( $check )){ > $dbSecureID = stripslashes($info[secureID]); > $fName = stripslashes($info['fName']); > $lName = stripslashes($info['lName']); > //gives error if the password is wrong > } > > // check out this code! > > $userName=''; > if(!$userName = "$fName $lName"){ > die("no value"); > }else{ > echo "hello world"; > exit(); > } > // it never processes, what gives?? > // then my email form is never sent > // is there something wrong with the form submittion? > > > > if ($secureID != $dbSecureID) { > die('This user has not registered yet!'); > } else{ > mysql_query("UPDATE user SET confirmIDFlag=1 WHERE id=$userID")or > die(mysql_error()); > > > require("php/class.phpmailer.php"); > $mail = new PHPMailer(); > // set mailer to use SMTP > $mail->Host = "relay-hosting.secureserver.net"; > > $mail->From = "sermon8or@1purpose-bethel.org"; > $mail->FromName = "Pastor Art Gorman"; > $mail->AddAddress("kraleigh@sbcglobal.net", "$userName"); > $mail->WordWrap = 50; > $mail->IsHTML(true); > > // set email format to HTML > > $mail->Subject = "Welcome $userName"; > $mail->Body = "This email is to inform $userName<br/> that > you have been added to our mailing list"; > $mail->AltBody = "This email is to inform $userName<br/> that > you have been added to our mailing list"; > > if(!$mail->Send()) > { > echo "Message could not be sent. <p>"; > echo "Mailer Error: " . $mail->ErrorInfo; > exit; > } > } > ?> > <html><body><h1>Hello world</h1></body></html> > <?php > }else{ > > my html forms page... > <?php > } > ?> > > insight always appreciated > thank you > Kevin Raleigh > Problem resolved Thank you Kevin Raleigh |
![]() |
| Thread Tools | |
| Display Modes | |
|
|