Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: PHP Email Help

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    27
    Member #
    31494
    Hi

    I have created a php forgotten password page but when I receive the forgotten password email, I only get the email address in the email and not the username and password, its not collecting the username and password data for some reason

    The php coding is below in the forgottenpassword.php

    PHP Code:
    <?php
    if($go == "1")
    {
    $connect mysql_connect("host","username","password");
    if (!
    $connect)
    {
    die(
    "MySQL could not connect!");
    }

    $DB mysql_select_db('databasename');

    if(!
    $DB)
    {
    die(
    "My SQL could not select Database!");
    }
    }

    $Username $_POST['username'];
    $Email $_POST['email'];
    $Email1 "@";
    $Email_Check strpos($Email,$Email1);
    $Password $_POST['password'];
    $message_field $_POST['username, password'];
    $message "$Email$Username$Password$message_field";
    ?>
    <?php
    //These are the variables for the email

    $sendto $_POST['email']; // this is the email address collected from the form
    $ccto "ianhaney@irhwebsites.co.uk"//you can cc it to yourself
    $subject "Your Registration Details"// Subject
    $message "Email Address: " $Email "\n\n" "Username: " $Username "\n\n" "Password: " $Password "\n\n" "$message_field";
    $header "From: ianhaney@irhwebsites.co.uk\r\n";
    $header .= "Reply-to: ianhaney@irhwebsites.co.uk\r\n";
    // This is the function to send the email
    mail($sendto$subject$message$header$message_field);
    echo 
    "Your password has been sent to "$Email .".";
    ?>
    Below is what the email comes out like

    Email Address: ianhaney@irhwebsites.co.uk

    Username:

    Password:

    But is still not getting the data for some reason

    my html form is below

    HTML Code:
    <form action="forgotpassword.php" method="post">
    E-mail: <input type="text" name="email" size="24" border="0">
    <br>
    <input type="hidden" name="username" border="0">
    <input type="hidden" name="password" border="0">
    <input type="hidden" name="go" value="1" border="0">
    <input type="submit" name="submitButtonName" value="Submit" border="0">
    </form>


  2.  

  3. #2
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    92 times
    Super confused. You have the username and password as hidden inputs with no value - so these are being sent as NULL values (empty strings). What are you expecting to get sent?
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)

  4. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    27
    Member #
    31494
    Hi Mark how you been, long time no speak

    I was hoping to have the username and password included in the email the user received if they forgot their password

    I have got rid of the coding now to be honest as couldn't do it lol


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:20 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com