Php syntax error

Closed
ravisth7 Posts 1 Registration date Tuesday November 20, 2012 Status Member Last seen November 20, 2012 - Nov 20, 2012 at 02:57 AM
pablojorgesanguinetti1 Posts 265 Registration date Friday February 22, 2013 Status Contributor Last seen November 27, 2020 - Mar 25, 2013 at 08:47 PM
Hello guys,
I've a problem executing my php file. could u please help me resolve this???
my codes area as follows:


<?php



if(isset($_POST['submit'])){

$email = "info@shakesushi.de";$subject = "Contact form Query";
$fromEmail = ($_POST['Email']);


$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html: charset=iso-8859-1' . "\r\n";




// Additional headers
$headers .= 'To: <'.$email.'>' . "\r\n";


$headers .= 'From: <'.$fromEmail.'>' . "\r\n";


$strContent = '<p>You have been contacted via the website http://www.lieferprofi.de Sushi) with subject <u></u>.

Details are as follows:</p>'.chr(13);


$strContent .= '<table cellspacing=2 cellpadding=0>'.chr(13);


foreach($_POST as $k=>$v)

{


$$k = $v;


if($k != 'submit' && $k != 'Subject'):


$strContent .= '<tr>'.chr(13).'<th>'.str_replace("_"," ",$k).':</th>'.chr(13).'<td>'.$v.'</td>'.chr(13).'</tr>';



endif;


}


//print $strContent;
$bStatus = mail($email,$subject,$strContent,$headers);


if($bStatus == true):


echo '<script>alert("Your information has been submitted");</script>';


echo '<script>window.location="'.$_SERVER['HTTP_REFERER'].'";</script>';
else:


echo '<script>alert("Error: couldnot submit, please try again");</script>';

echo '<script>window.location="'.$_SERVER['HTTP_REFERER'].'";</script>';


endif;


}




?>

1 response

pablojorgesanguinetti1 Posts 265 Registration date Friday February 22, 2013 Status Contributor Last seen November 27, 2020
Mar 25, 2013 at 08:47 PM
Hi!

Are you using PHP variable variables?
I'm not sure, but have you tried using curly braces?

${$k} = $v;

Good luck!
0