Forum Moderators: coopster
<div class="img"> <p>testing:</p> <input type="image"
src="Pictures/image1.jpg" name="test" width="200px" height="180px">
</div>
<div class="img"> <p>testing 2:</p> <input type="image"
src="Pictures/image2.jpg" name="test2" width="200px" height="180px">
</div>
Below is the php script:
<html>
<head>
Template
</head>
<body>
<h1>this is a test for the template</h1>
<?php
if($name==$_POST["test"]) {echo '<p>test1</p>';}
else if($name==$_POST["test2"]) {echo '<p>test2<p2>';}
?>
</body>
</html>.
The problem is, it prints out "test1" in both cases.
Help would be much appreciated. And I apologies if a similar thread has already been created.
Kind Regards
What is $name? I would probably use isset [php.net].
if (isset($_POST['test_x'])) {
echo '<p>test1</p>';
} else if (isset($_POST['test2_x'])) {
echo '<p>test1</p>';
}