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
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts

    Question Any help on formatting with a <hr> or --------- after each item?

    Had to change this up a bit, was getting 5 or more even if there was only one.

    Where do I put the loop? also which loop? DO while or While do?

    PHP Code:

    // *** Mail form as Text format ***
    if (isset($_POST["email"])) {
    $db mysql_connect("localhost""user""pass"); 
    mysql_select_db("db1",$db); 
    $name trim($HTTP_GET_VARS['name']);
    $query=("SELECT * FROM table WHERE name ='$name'");
    $resultmysql_query($query);
    $num=mysql_num_rows($result);
    if (
    $num 0) { //Records match
    //trim($_POST['email'])
    //define the receiver of the email
    $to trim($_POST['email']);
    //define the subject of the email
    $subject 'My Wishlist'
    //define the message to be sent. Each line should be separated with \n
    $message "My Wishlist"."\n\n"
    $message .= "Code: "$code."\n";
    $message .= "Description: "$description."\n";
    $message .= "Diamond info: "$diamondinfo."\n";
    $message .= "Price: "$price."\n";
    $message .= "------------------------";
    //define the headers we want passed. Note that they are separated with \r\n
    $headers "From: ".$to;
    //$headers = "From: $to\r\nReply-To: $to";
    //send the email
    $mail_sent = @mail$to$subject$message$headers );
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
    //echo $mail_sent ? "Mail sent" : "Mail failed";
    }else{
    //no send
    }

    Last edited by student101; 08-02-2008 at 12:54 PM.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  • #2
    New Coder
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    2
    Thanked 1 Time in 1 Post
    After:
    PHP Code:
    //define the message to be sent. Each line should be separated with \n
    $message "My Wishlist"."\n\n"
    Add something like:
    PHP Code:
    while( $row mysql_fetch_assoc$result ) )
    {
    $message .= "Code: "$result['code']."\n";
    $message .= "Description: "$result['description']."\n";
    $message .= "Diamond info: "$result['$diamondinfo']."\n";
    $message .= "Price: "$result['price']."\n";
    $message .= "------------------------"

    That is assuming, of course, that your table fields are named code, description, diamondinfo, and price.

    --Josh
    Last edited by infinivert; 08-02-2008 at 02:11 PM. Reason: typo

  • Users who have thanked infinivert for this post:

    student101 (08-02-2008)

  • #3
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    Wow that worked!

    Thank you!!!
    Quote Originally Posted by infinivert View Post
    After:
    That is assuming, of course, that your table fields are named code, description, diamondinfo, and price.
    --Josh
    These loop fors and while loops always confuse me,
    thanks man.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  • #4
    New Coder
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    2
    Thanked 1 Time in 1 Post
    No prob. Anytime.

  • #5
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    I feel like a god with this HTML email thingy, it's fantastic!!!

    Cheers
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:


  •  

    Posting Permissions

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