Page 1 of 1

new to php, trouble with $POST

Posted: Sat Nov 27, 2010 11:01 am
by stuckne1
I'm simply trying to get an action when a button is clicked, but when I click the btnAdd nothing happens...

<html>
<head>
<title>Add New User</title>
</head>
<body>
<form action="addUser.php" method="post">
<h1>Add New User</h1>
<table>
<tr>
<td></td>
<td><input type="button" name='btnAdd' value="Add" ></td>
</tr>
</table>
<?php echo("itch"); ?>
<?php print('itch'); ?>
<?php

if (isset($_POST['btnAdd']))
{
print("btn test");
//testFunction();
}
</form>
</body>
</html>

Re: new to php, trouble with $POST

Posted: Sat Nov 27, 2010 1:19 pm
by McInfo
1. You should be getting a parse error because a PHP closing tag is missing after the if block.

2. An <input type="button"> does not submit a form, but an <input type="submit"> does.

3. Please use BBCode tags in your posts. Try the PHP Code button on the submission form.

Re: new to php, trouble with $POST

Posted: Sat Nov 27, 2010 10:47 pm
by stuckne1
okay thanks! Those changes worked.