Jump to content

Can i use input type="button"


Recommended Posts

Hi, I need some help,can i use input type="button" when deleting data in my database, Okay,this is how i made my code,i displayed all the records in the database using the Table,and i am using PDO.what i want is to click the delete button and this will redirect to the goDelete.phpand my problem in goDelete.php is i cannot displayed the idno and the name.Can you help me on this.Thank you in advance.

while($fld = $count->fetch(PDO::FETCH_OBJ))  {    ......    echo '<td>'.$fld->idno.'</td>';    echo '<td>'.$fld->Name.'</td>';    echo '<td><input type="button" name="delete"   value="Delete" onclick="delete()">  </input></td>';}

my script

function delete(){	 window.location.href="goDelete.php";}

  • Like 1
Link to comment
Share on other sites

 echo '<td><input type="button" name="delete"   value="Delete" onclick="delete('.$fld->idno.','.$fld->Name.')">  </input></td>';

function delete(thisidno, thisname){         window.location.href="goDelete.php?idno="+thisidno+"&name="+thisname;}

in goDelete.php

thisidno = $_GET['idno']; thisname $_GET['name'];

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...