Results 1 to 6 of 6

Thread: e-mail link variable
      
   

  1. #1
    sailbaby is offline Private
    Join Date
    Apr 2007
    Posts
    4

    Default e-mail link variable

    Hi All:

    I have written or rather modified a script from a tutorial I did to work for my needs, and when I try to turn the email variable into a link for example a href=mailto: it doesn't work. I need it to grab the email address that is associated with the id in which the script is calling. Below I have posted my script if anyone has an idea what the problem is. I have highlighted in red the part I have the problem with. If anybody out there can help me with this, that would be grand.

    $page_title = 'View a Yachtie and Download CV';
    include ('./includes/header.html');

    // Check for a valid user ID, through GET or POST.
    if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // Accessed through view_users.php
    $id = $_GET['id'];
    } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { // Form has been submitted.
    $id = $_POST['id'];
    } else { // No valid ID, kill the script.
    echo '<h1 id="mainhead">Page Error</h1>
    <p class="error">This page has been accessed in error.</p><p><br /><br /></p>';
    include ('./includes/footer.html');
    exit();
    }

    require_once ('../mysql_connect.php'); // Connect to the db.

    // Check if the form has been submitted.
    if (isset($_POST['submitted'])) {

    if ($_POST['sure'] == 'Yes') { // Delete them.

    // Make the query.
    $query = "DELETE FROM captains WHERE user_id=$id";
    $result = @mysql_query ($query); // Run the query.
    if (mysql_affected_rows() == 1) { // If it ran OK.

    // Print a message.
    echo '<h1 id="mainhead">View a Yachtie</h1>
    <p>The user has been deleted.</p><p><br /><br /></p>';

    } else { // If the query did not run OK.
    echo '<h1 id="mainhead">System Error</h1>
    <p class="error">The user could not be deleted due to a system error.</p>'; // Public message.
    echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.
    }

    } else { // Wasn't sure about deleting the user.
    echo '<h1 id="mainhead">View a Yachtie</h1>
    <p>The user has NOT been deleted.</p><p><br /><br /></p>';
    }

    } else { // Show the form.

    // Retrieve the user's information.
    $query = "SELECT CONCAT(first_name, ' ', last_name, '<p><br><b>E-Mail Address:</b></p><a href=\"mailto:$email\">$email ', email, '<p><br><b>Phone Number:</b></p> ', phone_1, '<p><br><b>A Second Number:</b></p> ', phone_2, '<td valign=top><p><br><b>What Ticket:</b></p> ', ticket, '<p><br><b>Nationality:</b></p>', nationality, '<p><br><b>Position Desired:</b></p>', position, '<p><br><b>Date you Registered:</b></p> ', DATE_FORMAT(registration_date, '%d %M %Y')) FROM captains WHERE user_id=$id";
    $result = @mysql_query ($query); // Run the query.

    if (mysql_num_rows($result) == 1) { // Valid user ID, show the form.

    // Get the user's information.
    $row = mysql_fetch_array ($result, MYSQL_NUM);

    // Create the form.
    echo '<h1>View Yachtie</h1>
    <form action="view_yachtie.php" method="post">

    <h3>&nbsp;&nbsp;</h3>


    <input type="hidden" name="submitted" value="TRUE" />
    <input type="hidden" name="id" value="' . $id . '" />



    <table border="0" width="100%" id="table1" cellspacing="1">
    <tr>
    <td><p><br><b>Name:</b><br></p> ' . $row[0] . ' </td>
    </table>
    </form>';

    } else { // Not a valid user ID.
    echo '<h1 id="mainhead">Page Error</h1>
    <p class="error">This page has been accessed in error.</p><p><br /><br /></p>';
    }

    } // End of the main Submit conditional.

    mysql_close(); // Close the database connection.

    include ('./includes/footer.html');
    ?>
    Last edited by sailbaby; 04-10-2007 at 02:34 AM. Reason: typo

  2. #2
    Mook25's Avatar
    Mook25 is offline Brigadier General
    Join Date
    Oct 2005
    Location
    UK
    Posts
    1,430

    Default Re: e-mail link variable

    <a href=\"mailto:$email\">$email ', email,

    Try taking out the first backslash, coloured green above and see if that helps.
    Arcade Ninja - Free Flash Arcade
    FreeGadget4me.Com - Learn how to get free gadgets delivered direct to your door for free

  3. #3
    sailbaby is offline Private
    Join Date
    Apr 2007
    Posts
    4

    Default Re: e-mail link variable

    Cheers Wook, I'll give that a go, but I think I already did. Also, how does one upload their image on this forum?

  4. #4
    sailbaby is offline Private
    Join Date
    Apr 2007
    Posts
    4

    Default Re: e-mail link variable

    Nope, didn't work. Just makes the whole page go blank. Wish I could figure this problem out. Thanks again though, and if you have another idea, then by all means, please let me know.

  5. #5
    Mook25's Avatar
    Mook25 is offline Brigadier General
    Join Date
    Oct 2005
    Location
    UK
    Posts
    1,430

    Default Re: e-mail link variable

    Quote Originally Posted by sailbaby
    Cheers Wook, I'll give that a go, but I think I already did. Also, how does one upload their image on this forum?
    Are you talking about an avatar or a profile image?Both can be uploaded by clicking on 'user cp' in the top left corner of the forum when you're logged in but there are size restrictions. i think 80x80 for the avatar but not sure on the profile image.

    With regards the script i'd suggest maybe speaking with the author of the script or if the site where you got it from has a forum you could ask there.
    Arcade Ninja - Free Flash Arcade
    FreeGadget4me.Com - Learn how to get free gadgets delivered direct to your door for free

  6. #6
    sailbaby is offline Private
    Join Date
    Apr 2007
    Posts
    4

    Default Re: e-mail link variable

    Thanks Wook...

    I have been getting some help at the author's forum both from him and a couple of others, but I'm pulling my hair out on some of this. Have you ever used any of Larry Ullman's books?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49