Albinal
06-04-2007, 09:18 AM
I have some problems understanding things in PHP and would really appreciate some help.
I'm not a programmer but I have a basic knowledge of programming. I can do basic Javascript/ActionScript and ASP and understand IF statements and variables but database connection, loops and arrays are beyond my comprehension.
I made a website in flash for an animation I did (www.robinvspirate.com). The flash form sends data to a PHP script which has this in it:
<?
$sName=$_GET["sName"];
$sContact=$_GET["sContact"];
$sComments=$_GET["sComments"];
$to .= "me@myemailaddress.com";
$subject .= "ROBINvsPIRATE on-line contact form";
//Main body
$msg .= "Name: $sName\n\n";
$msg .= "E-mail address: $sContact\n\n";
$msg .= "Comments/message: $sComments\n\n";
mail($to, $subject, $msg, "From: ROBINvsPIRATE.com[/email]\nReply-To: $sContact\n");
?>
I tested it before making the site live and it worked. I had a form submitted on the 2nd which had undefined in all fields. I tested it today and it worked.
Why would it work for me and not for someone else? How could it stop and start working without me touching it? I don't understand this.
Secondly, I wanted to make a basic image viewer (www.albinal.com/squad.php) where the image and the next/previous links changed based on the selection.
I used this code:
<?
$imageID=$_GET["imageID"];
if ($imageID == "")
{
$imageID = 1;
}
echo '<p align="center"><img src="images/vector_art/small_va'. $imageID .'.gif" style="border:1px solid #000000;" alt=""></p>';
$TotalImages = 8;
$next = $imageID = $imageID + 1;
$previous = $imageID = $imageID - 1;
?>
The next link works fine but the previous link doesn't. Unless I swap these lines around:
$next = $imageID = $imageID + 1;
$previous = $imageID = $imageID - 1;
Then the previous link will work but the next doesn't. This seems to suggest that the $imageID variable is changing based upon what the other variables do, which confuses me.
Sorry for the long post but if someone can help with this then I think my understanding will be much better.
Many thanks.
I'm not a programmer but I have a basic knowledge of programming. I can do basic Javascript/ActionScript and ASP and understand IF statements and variables but database connection, loops and arrays are beyond my comprehension.
I made a website in flash for an animation I did (www.robinvspirate.com). The flash form sends data to a PHP script which has this in it:
<?
$sName=$_GET["sName"];
$sContact=$_GET["sContact"];
$sComments=$_GET["sComments"];
$to .= "me@myemailaddress.com";
$subject .= "ROBINvsPIRATE on-line contact form";
//Main body
$msg .= "Name: $sName\n\n";
$msg .= "E-mail address: $sContact\n\n";
$msg .= "Comments/message: $sComments\n\n";
mail($to, $subject, $msg, "From: ROBINvsPIRATE.com[/email]\nReply-To: $sContact\n");
?>
I tested it before making the site live and it worked. I had a form submitted on the 2nd which had undefined in all fields. I tested it today and it worked.
Why would it work for me and not for someone else? How could it stop and start working without me touching it? I don't understand this.
Secondly, I wanted to make a basic image viewer (www.albinal.com/squad.php) where the image and the next/previous links changed based on the selection.
I used this code:
<?
$imageID=$_GET["imageID"];
if ($imageID == "")
{
$imageID = 1;
}
echo '<p align="center"><img src="images/vector_art/small_va'. $imageID .'.gif" style="border:1px solid #000000;" alt=""></p>';
$TotalImages = 8;
$next = $imageID = $imageID + 1;
$previous = $imageID = $imageID - 1;
?>
The next link works fine but the previous link doesn't. Unless I swap these lines around:
$next = $imageID = $imageID + 1;
$previous = $imageID = $imageID - 1;
Then the previous link will work but the next doesn't. This seems to suggest that the $imageID variable is changing based upon what the other variables do, which confuses me.
Sorry for the long post but if someone can help with this then I think my understanding will be much better.
Many thanks.