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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    120
    Thanks
    6
    Thanked 2 Times in 2 Posts

    PHP variables not being forwarded into email

    Hi,

    I have a "report broken" page that has variables in the url($movie_id, $version, $title). Can someone take a look at my form, and php script and try to figure out why it won't send the variables through to my email?

    Here is my form:

    Code:
    <form action="reportbroken.php" method="POST">
    <div style="width:100%; border:#3A74AD 2px solid; background-color:#c3d4e4; padding-top:5px; padding-bottom:5px; text-align: center;"><span style="font-weight:bold;"><?php if (isset($_GET['movie_id'])) { echo $_GET['version']; } else if (isset($_GET['tv_show_id'])) { echo $_GET['tvversion']; } ?> of <?php if (isset($_GET['movie_id'])) { echo $_GET['title']; } else if (isset($_GET['tv_show_id'])) { echo $_GET['tvtitle']; } ?> not working?</span></div>
    
    <br />
    <div style="width:100%; margin-left: 15%;">
    <?php
    
    require_once('recaptchalib.php');
    
      $publickey = "6LdONcUSAAAAAGjPZFrwQKr_gjsloMIgg3DgstGB"; 
    
      echo recaptcha_get_html($publickey);
    
    ?>
    
    <br />
    
    <table>
    
    <tr>
    
    <td width="150px" style="padding-left: 30px;">
    
    <img width="75px;" height="75px;" src="/images/problemface.jpg" />
    
    </td>
    
    <td width="125px" style="padding-left: 30px;">
    
    <input type="submit" src="" value="Report Broken" id="report_broken" class="report_broken"/>
    
    </td>
    
    </table>
    
    <input type="hidden" name="movie_id" value="<?php if (isset($movie_id)) { echo $movie_id; } else if(isset($tv_show_id)) { echo $tv_show_id; }?>" />
    
    <input type="hidden" name="title" value="<?php if (isset($movie_id)) { echo $title; } else if(isset($tv_show_id)) { echo $tvtitle; }?>" />
    
    <input type="hidden" name="version" value="<?php if (isset($movie_id)) { echo $version; } else if(isset($tv_show_id)) { echo $tvversion; }?>" />
    
    </form>
    And here is the php to post the variables to my email:

    PHP Code:
    <?php
    if(isset($_GET['movie_id'])) {
    $_GET['title'];
    $_GET['movie_id'];
    $_GET['version'];
    $title mysql_real_escape_string(stripslashes(strip_tags($_GET['title'])));
    $movie_id mysql_real_escape_string(stripslashes(strip_tags($_GET['movie_id'])));
    $version mysql_real_escape_string(stripslashes(strip_tags($_GET['version'])));
    }

    //define the receiver of the email
    $to "xxxxxxxxxxxx@gmail.com";
    //define the subject of the email
    $subject "" $title " not working as intended"
    //define the message to be sent. Each line should be separated with \n
    $message "" $version " of " $title " has been reported not working.  Movie ID: " $movie_id " "
    //define the headers we want passed. Note that they are separated with \r\n
    $headers "From: reportbrokenlinks@mattsmoviemadness.com";
    //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 "Report sent.  Thank you for your time and help!" "Mail failed to send.  Please try again!";
    ?>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Code:
    <form action="reportbroken.php" method="POST">
    Code:
    if(isset($_GET['movie_id']))
    Any clues?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Jan 2011
    Posts
    120
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Well I feel kinda dumb for not noticing that! But that's still not pulling the variables into the email.

  • #4
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    PHP Code:
    $_GET['title'];
    $_GET['movie_id'];
    $_GET['version']; 
    not needed

    PHP Code:
    $title mysql_real_escape_string(stripslashes(strip_tags($_GET['title'])));
    $movie_id mysql_real_escape_string(stripslashes(strip_tags($_GET['movie_id'])));
    $version mysql_real_escape_string(stripslashes(strip_tags($_GET['version']))); 
    PHP Code:
    <form action="reportbroken.php" method="POST"
    PHP Code:
    if(isset($_GET['movie_id'])) 

    see it yet?
    A programmer is just a tool which converts caffeine into code

    My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
    My hobby: http://www.angel-computers.co.uk
    My life: http://www.furious-angels.com


  •  

    Posting Permissions

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