I have done a bit with php previously but not really worked with it in the past few years. When I did so I wwas more accustomed to the ISAPI set up which now it seems has become obsolete.
When I last did any work with PHP OIt was more or less around the time PHP 4 moved up to 5 - I remember having gotten in contact with Larry Ulmann at the time as a lot of the Global Syntax had changed and couldn't work through his books. Even with the pHP titles I bought the code Larry used I am sure was pho 5 but by the time I bought the book the syntax had changed. This seems to be the case with nearly every update to php, not only the syntax but also the configuration...
I now find existing scripts I had, that ran in 5.2.10 on an isapi install only a few days ago are now giving me trouble
Included here is the first snippet:
Code: Select all
<?php
if($process) {
@extract($_POST);
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$message = stripslashes($message);
$origin = "This email originated on the webform at http://www.coup.com";
mail("headless_chikkin@coup.com",$subject,$message,
"From: $name <$email>\r\n" .
"Reply-To: $name <$email>\r\n" .
"X-Mailer: PHP/" . phpversion());
$message = str_replace("\n","<br>",$message);
echo "<h3><font color= #545F1D>Your message has been sent succesfully!!!</font></h3><hr/>";
echo "<b><font color= #660000>From:</font></b> $name <".$email."><br/><br/>";
echo "<b><font color= #660000>Subject:</font></b> $subject<br>";
echo "<hr/><br/><b><font color= #000000>Message:</font></b> <i>$message</I><br/>";
echo "<br/><hr/>";
echo "<b><font color= #660000>Thank You for your comment</font></b>";
}
else
{
echo "<font color= #000000>Sorry but you can't access this page directly</font>";
?>
}I had a heckuva time setting up 5.3 on a 64bit Vista machine but followed this very well explained step by step on installing FastCGI PHP and it seems to be running fine except for the fact it is throwing a lot of parser errors.
In the snippet above the script falls down at:
if($process)
The second example should be a lot more straight forward... but for the life of me I cannot figure out why the script is falling down, I have explicitly declared variables (This exercise btw comes from Larry's PHP 5 and MySQL 6 for Dynamic Websites title) and given them valued derived directly from the Posted Values on the Html form. The names I have treble chequed a dozen times.... and still I am getting undefined index error messages.
here is the php end of the script
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Feedback</title>
</head>
<body>
<?php # Script 2.2 - handle_form.php
// Create a shorthand for the form data:
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$comments = $_REQUEST['comments'];
/* Not used:
$_REQUEST[‘age’]
$_REQUEST[‘gender’]
$_REQUEST[‘submit’]
*/
// Print the submitted information:
echo "<p>Thank you, <b>$name</b>, for the following comments:<br />
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email</i>.</p>\n";
?>
</bodyCan anyone please shed some light on why supposedly very straight-forward scripts are suddenly coming horribly undone on this'latest flavour')
Thanks in advance
- ps forgot to mention I have changed $-REQUEST to $_GET and $_POST nothing makes any difference. I suspect variable definition has once again gotten an overhaul