...

View Full Version : PHP variables not being forwarded into email



MattClark
10-11-2011, 06:15 AM
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:



<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
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!";
?>

abduraooft
10-11-2011, 10:49 AM
<form action="reportbroken.php" method="POST">


if(isset($_GET['movie_id']))
Any clues?

MattClark
10-11-2011, 11:52 AM
Well I feel kinda dumb for not noticing that! But that's still not pulling the variables into the email. :(

hinch
10-11-2011, 12:01 PM
$_GET['title'];
$_GET['movie_id'];
$_GET['version'];

not needed


$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'])));


<form action="reportbroken.php" method="POST">


if(isset($_GET['movie_id']))


see it yet?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum