Hello to everyone.
I want to clean a field from my Data Base in MySQL from a button. But I don't know how
i can create a button in PHP, the funtion of button is TRUNCATE TABLE(Table).
I have a form in HTML but hi don't work because when I press the button he don't do
anything, but when i press the button submit he work I don't know way!!!
Here are the Form HTML Code:
<FORM Name="Form1" METHOD="post" >
Nick : <INPUT TYPE="text" NAME="nick" SIZE=20 MAXLENGTH=20>
<BR>
Email: <INPUT TYPE="text" NAME="email" SIZE=28 MAXLENGTH=100>
<BR>
Password: <INPUT TYPE="password" NAME="password" SIZE=28 MAXLENGTH=20>
<BR>
Nombre: <INPUT TYPE="text" NAME="nombre" SIZE=28 MAXLENGTH=255>
<BR>
<INPUT TYPE="submit" CLASS="boton" VALUE="Registrar">
<INPUT TYPE="reset" name="Submit" value="Restablecer">
<INPUT TYPE="button" name="CleanBD" value="Limpiar BD" onClick="<?Limpiar()?>" >
</FORM>
and here are the code in PHP:
function Limpiar() {
$servidor = "localhost" ;
$usuario = "usuario" ;
$contrasena = "password" ;
$basededatos = "bd" ;
$conectar = mysql_connect($servidor, $usuario, $contrasena);
mysql_select_db($basededatos,$conectar) ;
$Limpiar = "Truncate table bd";
mysql_query($Limpiar);
}
how I cant create a button in PHP that he make the same function????
thanks
Yusdaniel