View Single Post
Old 07-11-2007, 06:30 PM   #2 (permalink)
Vormund
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: using one text box for different variables (php)

Hmm, what'cha mean? Like this?

http://www.vormund.net/eg/buysell.php

Click the button, and it'll be echoed out along with the text box. So then you could do a simple
PHP Code:
if ( $_POST['butonName'] ) {
  
// do this
} else {
  
// do this

The code behind buysell.php is very simple:

PHP Code:
<?php 
foreach( $_POST as $var => $val )
  echo 
$var.":".$val."<br>";
?>
<form action="<?= $_SERVER['PHP_SELF'?>" method="post">
  <input type="text" name="stuff"><br>
  <input type="submit" name="buy" value="Buy">
  <input type="submit" name="sell" value="Sell">
</form>
I guess the bottom line is by putting a name on the submit tag, it'll show up as a variable, too.
__________________
Vormund is offline