abch624 Posted June 25, 2008 Share Posted June 25, 2008 Hi there I want to use text as a button. If you have a look at the code bellow: <form class="form" method="post" action="newaccount.php"> <tr> <td width="150"> <input type="text" name="newaccountname" value="New Account" tabindex="3"> </td> <td align="center" width="32"> <a href="/1STA/newaccount.php">add</a> </td> <td width="41"> </td> <td width="41"> </td> </tr> <!-- PHP BEGIN --> </form> I want to use the <a href="/1STA/newaccount.php">add</a> as a button so that the newaccountname is passed to the newaccount.php file. At the moment this is not working and just goes to the newaccount.php path but the variable is not posted. Please help... Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 25, 2008 Share Posted June 25, 2008 <a href="#null" onclick="document.['formname'].submit(); return false"> You have to give your FORM tag a Name="" also Quote Link to comment Share on other sites More sharing options...
abch624 Posted June 25, 2008 Author Share Posted June 25, 2008 I have changed the code as per <form class="form" method="post" name="newaccount" action="newaccount.php"> <tr> <td width="150"> <input type="text" name="newaccountname" tabindex="3"> </td> <td align="center" width="32"> <a href="#null" onclick="document.['newaccount'].submit(); return false">add</a> </td> <td width="41"> </td> <td width="41"> </td> </tr> <!-- PHP BEGIN --> </form> When I click on the add link the url changes to http://localhost/1STA/accountadmin.php#null and nothing happens. Any help.... Cheers - Zahid Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 25, 2008 Share Posted June 25, 2008 Yours: <form class="form" method="post" name="newaccount" action="newaccount.php"> Change to: <form class="form" method="post" name="newaccount" action="newaccount.php" name="newaccount"> Quote Link to comment Share on other sites More sharing options...
abch624 Posted June 25, 2008 Author Share Posted June 25, 2008 I changed the code to <a href="#null" onclick="document.forms.newaccount.submit()">add</a> and it works... Thanks - Zahid Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.