the reason it doesnt work, is becuase you have muddied the requests for the client and the server. PHP is completely server side, so putting a php function name in onclick, which will execute client side code doesnt work.
the solution would be to have you button reload the page, or submit to another page, that has your function call on it. make sense? Jason "Yusdaniel Rodriguez Espinosa" <[EMAIL PROTECTED]> wrote: > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php