[Solved] PHP session variable issue while using iframe


My objective is simple, I just need the 4 variables passed to the
second page. It did not happen when I tried without session, so I used
it per suggestion in another thread. The same code is not working even
when I remove the session details on the top.

Ok I get it now, get rid of all your Session you don’t need them at all

If your going to use the variable being posted from the form do this:

<?php

$subject = $_POST['subject'];
$message = $_POST['message'];
$name = $_POST['name']; 
$email = $_POST['email']; 

echo "hi";
echo $subject;
echo $message;
echo $name;
echo $email;

$to ='<my-email>';
$send_contact=mail($to,$subject,$message,$name);

if($send_contact)
  {
  echo "We've received your contact information";
  }
else 
  {
  echo "ERROR";
  }
?>

It did not work because you used the wrong names for POST variables, it should be the name of your html tags instead.

Hope this helps!

0

solved PHP session variable issue while using iframe