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... Link to comment https://forums.phpfreaks.com/topic/111887-solved-html-button/ 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 Link to comment https://forums.phpfreaks.com/topic/111887-solved-html-button/#findComment-574277 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 Link to comment https://forums.phpfreaks.com/topic/111887-solved-html-button/#findComment-574310 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"> Link to comment https://forums.phpfreaks.com/topic/111887-solved-html-button/#findComment-574314 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 Link to comment https://forums.phpfreaks.com/topic/111887-solved-html-button/#findComment-574316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.