andrew_biggart Posted April 7, 2009 Share Posted April 7, 2009 Ok im having a little trouble creating a send forgotten password page! its doing my head in to be frank! i found a good example, copied it and got it working. Now im trying to intigrate it into my page but it wont work. This is the example form. <table width="380" border="0" cellpadding="3" cellspacing="1" > <tr> <td width="33%"><strong>Enter your email : </strong></td> <td width="67%"><form name="form1" method="post" action="send_password_ac.php"> <input name="email_to" type="text" id="mail_to" size="25">USERNAME: <input name="username" type="text" id="username" size="25"> <input type="submit" name="Submit" value="Submit"> </form> </td> </tr> </table> This is the php page, which works with the example but doesnt send the password with my form. <? include("config_members.php"); // value sent from form $email_to=$_POST['email_to']; $username=$_POST['username']; // table name // value sent from form $email_to=$_POST['email_to']; // table name $tbl_name=User_infoT; // retrieve password from table where e-mail = $email_to([email protected]) $sql="SELECT Password FROM $tbl_name WHERE Email='$email_to' AND Username='$username'"; $result=mysql_query($sql); // if found this e-mail address, row must be 1 row // keep value in variable name "$count" $count=mysql_num_rows($result); // compare if $count =1 row if($count==1){ $rows=mysql_fetch_array($result); // keep password in $your_password $your_password=$rows['password']; // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email_to; // Your subject $subject="www.weloveweed.co.uk | Your password !"; // From $header="AdMiN <[email protected]>"; // Your message $header="from: AdMiN <[email protected]>\r\n"; $messages= "You forgot your fucking pssword you twat. Dont let this happen to offer or I will start to get extremly fucked off! \r\n"; $messages.="Your password is $your_password, so remember it this time. \r\n"; $messages.="If you continue to have problems then please use the contact us section of weloveweed to report the problem and any error you are receiving. \r\n"; $messages.="Luff AdMiN \r\n"; $messages .= "******************************This Is An Automatically Generated Message, Do Not Repond!"; // send email $sentmail = mail($to,$subject,$messages,$header); } // else if $count not equal 1 else { echo "<h1 class=comment_status2>You are not a registered member, please register to continue.</h1>"; } // if your email succesfully sent if($sentmail){ echo "<h1 class=comment_status1>Your Password Has Been Sent To Your Email Address.</h1>"; } else { echo "<h1 class=comment_status2>Cannot send password to your e-mail address.</h1>"; } ?> And hear is my form which doesnt seem to work for some reason even know its the same! <form method="form1" action="send_password_ac.php"> <table class="style3"> <tr><td colspan="2" class="style4"><strong>Forgot your password? Don't worry!</strong></td></tr> <tr> <td class="myprofile_subtext">Your email address :</td> <td><input name="email_to" id="mail_to" maxlength="100" type="text" /></td> </tr> <tr> <td class="myprofile_subtext">Username :</td> <td><input name="username" id="username" maxlength="8" type="text" value="" /></td> </tr> <tr> <td colspan="2" class="style5"><input class="login23" name="submit" type="submit" value="Email password" /></td> </tr> </table> </form> can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/152915-solved-sending-forgotten-password/ Share on other sites More sharing options...
Maq Posted April 7, 2009 Share Posted April 7, 2009 What I noticed immediately is that you have form1 for a method, but you're using POST. Change that, in the example you were using they used name="form1" method="POST", you mixed them up. Quote Link to comment https://forums.phpfreaks.com/topic/152915-solved-sending-forgotten-password/#findComment-803079 Share on other sites More sharing options...
andrew_biggart Posted April 7, 2009 Author Share Posted April 7, 2009 Thanks for that but it still isnt working! Quote Link to comment https://forums.phpfreaks.com/topic/152915-solved-sending-forgotten-password/#findComment-803083 Share on other sites More sharing options...
andrew_biggart Posted April 7, 2009 Author Share Posted April 7, 2009 Its working now thankyou Quote Link to comment https://forums.phpfreaks.com/topic/152915-solved-sending-forgotten-password/#findComment-803086 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.