Mythic Fr0st Posted January 3, 2007 Share Posted January 3, 2007 Ok, I've been working on this for a whileThe problem is, that I need when you click "Destroy Item" for it to do one action, and for Destroy Item, destroy the item, HOWEVER I cannot have 2 form submit buttons, so Im trying with a "Button" for the 2nd one, i've tried with and without using the onClick, it just wont DO anything at all, it goes no where:(if anyone could help me, i'd greatly appreciate it[code] <div style='position: absolute; top:340; left:850;'> <?php echo "<font color='darkblue' size='3'><b>Inventory</b><br /></font>"; echo " <form method=\"post\" action=\"{$currtown}\">"; ?> <select name='inv'> <?php foreach ($inv as $key => $value) { echo "<option value=\"{$key}\">{$inv[$key]}</option>"; } echo " </select> <input type='hidden' name='eq1' value='eq2'> <input type=\"submit\" value=\"Equip\"> </div> <div style='position: absolute; top:340; left:850;'> <input type=\"hidden\" name=\"d1\" value = \"d2\"> <input type=\"button\" value = \"Destroy Item\" onClick=\"{$currtown}\"> </form> </div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/ Share on other sites More sharing options...
corbin Posted January 3, 2007 Share Posted January 3, 2007 You could have form submit things for both, but base your PHP script off the action that button has... Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152067 Share on other sites More sharing options...
Mythic Fr0st Posted January 3, 2007 Author Share Posted January 3, 2007 What? when I have 2 submit buttons, they BOTH do the same action, it doesn't work Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152555 Share on other sites More sharing options...
genericnumber1 Posted January 3, 2007 Share Posted January 3, 2007 I really have no idea what you're saying ??? ... but if you're trying to submit the form you would need to use<input type="submit">not<input type="button"> Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152565 Share on other sites More sharing options...
Jessica Posted January 4, 2007 Share Posted January 4, 2007 onClick expects a javascript function. It looks like that is not what is there. Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152595 Share on other sites More sharing options...
corbin Posted January 4, 2007 Share Posted January 4, 2007 Example of 2 submit buttons, that do different things:[code=php:0]<?if(strlen($_POST['add']) > 0) {//add the username}else {//delete the username}if(!$_POST || $error) {?><form action="actionpage.php" method="POST">Username: <input type="test" name="username" value=""><br /><input type="submit" name="delete" value="Delete!"><br /><input type="submit" name="add" value="Add!"><br /></form><?}?> Quote Link to comment https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152610 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.