2

A simple html question i would like to make form that shows a different value to the one that it posts.

<form action="" method="post">          
<input type="submit" name="action" value="Buy"/>
</form>   

for example shows a button with Buy written on it and Buy is also posted. I would like it to show Buy, but I would like it submit a differnet value.

3 Answers 3

1

In theory you can:

<button type="submit" name="action" value="a differnet value">Buy</button>

In practise, we have to operate on a WWW that includes Internet Explorer.

You would probably be better off encoding the data into the name attribute and checking that.

Sign up to request clarification or add additional context in comments.

Comments

0

probably the easiest way to do it is to attach an event to the form submission to change the value for that input button. You could probably also put an onclick for the submit button itself.

<form action="" method="post">          
<input type="submit" name="action" value="Buy" onclick="this.value='some value';"/>
</form>   

Comments

0

The button within form is only for checking if the form is submitted or not. You don't need to get the value of the button. Simply write html code:

<form action="smth.php" method="post">          
<input type="submit" name="action" value="Buy"/>
</form> 

And smth.php will look like that

if(isset($_GET['action']))
{
...
do smth
...
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.