Jump to content

Php in an iframe acting funny.


segwaypirate

Recommended Posts

Here is the code in question:

<form method="post" action="../php/sendmail.php">
   <?php
   function RandomLine()
   {
   $textfile = "../messages/compliments.txt";
      if(file_exists($textfile))
      {
      $compliments = file($textfile);
      $string = $compliments[array_rand($compliments)];
      }
      else
      {
      $string = "Error";
      }
      return $string;
   }
   $line = RandomLine();
   echo "<p style='color: red;'>"."$line"."</p>";
   ?>
<br>
<input type="hidden" name="email" value="email@email.com">
<input type="hidden" name="subject" value="random compliment generator">
<input type="hidden" name="message" value="$line">
<input type="hidden" name="to" value="5555555555@mms.uscc.net">
<input  type="submit" name="sendtext" value="Send to phone!">
</form>

 

And here is the php from sendmail.php:

<?php
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
$to = $_REQUEST['to'];

$sent=mail($to, $subject, $message, "From: $email");
if($sent)echo "<br><p>The message was sent!</p>";
else echo "<br><p>There was an error while sending the message.</p>";
?>

 

When the form from the first bit of code is opened in an iframe, the echo displays the correct code but if the button is sent, the sms/email received simply says "$line".  Any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.