Jump to content

Forms & Php, Big Prob


Mythic Fr0st

Recommended Posts

Ok, I've been working on this for a while
The 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]
Link to comment
https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/
Share on other sites

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>
<?
}
?>
Link to comment
https://forums.phpfreaks.com/topic/32677-forms-php-big-prob/#findComment-152610
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.