Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP send page/information by email

    Hi,

    i need help on this subject, i have a website and i have a log in system with php and mysql, that works fine however i want my registered user to be able to send me information by email, they'd fill in a text field then press send. I need this to send the whole page so that it gets their username in so people can't put a another persons user name.

    heres my page http://www.dansufc.co.uk/login/login.php the username is test and the password is test

    you will notice that it welcomes the user then provides a box for a "review" i would like a button below this box saying send and it would send the whole page(the hi test bit and the review) please help as i am really stuck on the matter cheers,

    dansufc

  • #2
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'd just need to direct it to a page that captures the form variables. Somewhat the same way you're doing the login page.

    So, you're review page would need something like the following. You'd need to put the user's name into a hidden variable.

    Code:
    <form method="post" action="mailit.php">
    <input type="hidden" name="username" value="$username" />
    Review: <text area name="review" rows="10" cols="40"></textarea>
    <br />
    <input type="submit" value="Submit Review" />
    </form>
    And then in the mailit.php script, you'd just need something like:

    PHP Code:
    <?php

    $body 
    "Review by {$_POST['username']}\n\nReview: {$_POST['review']}";
    mail("youremail@yourdomain.com","Review Submission",$body);

    echo 
    "Thanks for submitting your review";

    ?>

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for you quick reply, the emailing works fine however because
    Code:
    <form method="post" action="mailit.php">
    <input type="hidden" name="username" value="$username" />
    Review: <text area name="review" rows="10" cols="40"></textarea>
    <br />
    <input type="submit" value="Submit Review" />
    </form>
    is in html when i get the email i get the email from $username and not the persons user name, any idea?
    Last edited by dansufc; 07-04-2007 at 11:36 AM.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Quote Originally Posted by dansufc View Post
    thanks for you quick reply, the emailing works fine however because
    Code:
    <form method="post" action="mailit.php">
    <input type="hidden" name="username" value="$username" />
    Review: <text area name="review" rows="10" cols="40"></textarea>
    <br />
    <input type="submit" value="Submit Review" />
    </form>
    is in html when i get the email i get the email from $username and not the persons user name, any idea?
    Are you echoing this out in the heredoc syntax or something? You literally have "$username" written out. Take out
    Code:
    <input type="hidden" name="username" value="$username" />
    replace with
    PHP Code:
    <input type="hidden" name="username" value="<?php echo $username?>" />
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks mate this has worked, would have been lost without all this help thanks alot!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •