Page 1 of 1
execution for form
Posted: Sun May 11, 2008 11:26 pm
by stevengoh
Hello everyone can check with you how to code the "2." one. I have a form that will sent the $going to execution, but unfortunately the below code not working.
Code: Select all
1.<input name=going> -------form
2.mysql_query ("insert into $going (description, ---------action
http://www.phpbb.com/community/viewtopi ... 6&t=950035
Re: execution for form
Posted: Sun May 11, 2008 11:33 pm
by LonelyProgrammer
You have to check for if submit is set in $_POST first.
Of course, it depends on the name you choose for your form. I recommend using a hidden field instead...
Code: Select all
<form....>
<input type="hidden" name="register_submit" value="1">
</form>
if (isset($_POST["register_submit")) {
// perform action
}
Re: execution for form
Posted: Sun May 11, 2008 11:42 pm
by stevengoh
thank for reply but i did put the _POST[action] but once i change to $going then the code don't seen to work ...
Code: Select all
<?php
include 'config2.php';
if($_POST[action]=="Submit")
{
mysql_query ("insert into [u]$going [/u](description, imgdata, username, password) values (\"".
$_REQUEST[description].
"\", \"".
$_FILES['imagefile']['name'].
"\", '$_REQUEST[user]', '$_REQUEST[pass]')");
}
?>
<html>
<head>
<title>Swim25.com</title>
</head>
<body>
<?php
if(!$action)
{
?>
<br> <form name="form" enctype="multipart/form-data" action="<?php print $PHP_SELF ?>" method="post">
<table width="100%" border="0" cellspacing="3" cellpadding="5" align="center">
<tr>
Please input images name <input type=file name=imagefile><br>
Please enter the description <input name=description><br>
Please input sql <input name=going><br>
User name <input type="text" name="user" value=""><br>
Password <input type="password" name="pass" value=""><br><br>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>