Hello,
I wondered if anyone could offer some guidance over my php script. I
was hoping the example would allow the user to click the submit
buttons and the item number increment.
And when the user clicks, the my basket icon the items.php scripts
starts and the variables from the current script are passed to this.
I tried to display the variables as the items are incremented, though
I got no value. Can anyone see the logical error?
Thank you
<?php
global $item1, $item2;
if(isset($_GET['item1'])){
$item1++;
}
if(isset($_GET['item2'])){
$item2++;
}
?>
<head>
<title>PHP Example</title>
</head>
<body>
<p>
<table border="0" width="100%">
<tr>
<td>
<a><img src="mybasket.j pg"></a>
</td>
</tr>
</table>
</p>
<form method=post>
<table border="0" width="79%">
<tr>
<td>
<input type="submit" name = "item1" value = "Add item1">
</td>
<td>
<input type="submit" name = "item2" value = "Add item2">
</td>
</tr>
</table>
</form>
</body>
</html>
I wondered if anyone could offer some guidance over my php script. I
was hoping the example would allow the user to click the submit
buttons and the item number increment.
And when the user clicks, the my basket icon the items.php scripts
starts and the variables from the current script are passed to this.
I tried to display the variables as the items are incremented, though
I got no value. Can anyone see the logical error?
Thank you
<?php
global $item1, $item2;
if(isset($_GET['item1'])){
$item1++;
}
if(isset($_GET['item2'])){
$item2++;
}
?>
<head>
<title>PHP Example</title>
</head>
<body>
<p>
<table border="0" width="100%">
<tr>
<td>
<a><img src="mybasket.j pg"></a>
</td>
</tr>
</table>
</p>
<form method=post>
<table border="0" width="79%">
<tr>
<td>
<input type="submit" name = "item1" value = "Add item1">
</td>
<td>
<input type="submit" name = "item2" value = "Add item2">
</td>
</tr>
</table>
</form>
</body>
</html>
Comment