On Mon, Aug 04, 2003 at 11:19:42PM +0100, skate wrote:
>
> i have several forms on one page, they all submit a different variable, i then want 
> to set one variable depending on that... okay, now i'm confusing myself, lets try 
> explain it with some code...
>
> if(isset($_POST))
> {
>  $type = $_POST['news'] || $_POST['dreams'] || $_POST['storys'] || $_POST['words'] 
> || $_POST['chat'];
> }

You have a single page, containing multiple forms, all of which share
the same action?  What about putting a hidden variable into each form to
provide an authoritative reference to which form was posted?  Then, if
processing unique to each form can be done with:

  if ($_POST['func']=="thisone") {
    // fooblah                    
  } else      
  if ($_POST['func']=="thatone") {
    // barblah                    
  } else      
  if ($_POST['func']=="another") {
    // otherblah                  
  } else {      
    die("Form hacking detected");
  }                              

And you can do things with the content of $_POST['func'], like this:

  $typelist=array(
    'thisone' => "This is one",
    'thatone' => "That is one too",
    'another' => "Another one here",
  );
  $type=$typelist[$_POST['func']];

Is that long the lines of what you're looking for?

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to