RE: [PHP] 2values on form, help in catching as one.

2003-07-02 Thread Miranda, Joel Louie M
Hi everyone!

What I did to make it work is..

-- -- 
if (array_key_exists('Template', $_GET)) {
  $template = join (" ", $_GET['attributes']);
}

switch($template) {
 case 'TemplateOne':
 echo "one";
 break;

 case 'TemplateTwo':
 echo "two";
 break;
}
-- -- 

As simple as that. :)

Im learning!


--
Thank you,
Louie


-Original Message-
From: Mark [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 02, 2003 10:41 PM
To: Miranda, Joel Louie M; '[EMAIL PROTECTED]'
Subject: Re: [PHP] 2values on form, help in catching as one.


It's not clear what you're trying to do. If the values are for a radio
button or checkbox, use the same name for both buttons. 

The values have to be mutually exclusive for what you;re trying to do to
work.

You could do something like this:

if (isset($_REQUEST['TemplateOne']) {
  $test=$_REQUEST['TemplateOne'];
} elseif (isset($_REQUEST['TemplateTwo']) {
  $test=$_REQUEST['TemplateTwo'];
} else {
  $test="";
}

echo $test;

--

or this:
$test=0
if (isset($_REQUEST['TemplateOne']) {
  $test=1;
}
if (isset($_REQUEST['TemplateTwo']) {
  $test+=2;
}

switch ($test) {
  case 1:
  echo "one";
  break;
  case 2:
  echo "two";
  break;
  case 3:
  echo "one and two";
  break;
}

Without knowing what you're actually trying to do, however, we're all just
shooting in the dark.

--- "Miranda, Joel Louie M" <[EMAIL PROTECTED]> wrote:
> I have this php code (below), My form passes 2 values w/c is 
> TemplateOne and TemplateTwo I was wondering how could I make that in 
> php to catch the value
> as one only? I tried this and it didn't work. But if the value is
> just one
> the case display it. Any ideas?
> 
>$v_template = $_REQUEST['TemplateOne'] ;
>   $v_template = $_REQUEST['TemplateTwo'] ;
> 
> switch($v_template) {
>  case 'TemplateOne':
>  echo "one";
>  break;
> 
>  case 'TemplateTwo':
>  echo "two";
>  break;
> }
> ?>
> 
> --
> Thank you,
> Miranda, Louie
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to
death to defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: [PHP] 2values on form, help in catching as one.

2003-07-02 Thread Mark
It's not clear what you're trying to do. If the values are for a
radio button or checkbox, use the same name for both buttons. 

The values have to be mutually exclusive for what you;re trying to do
to work.

You could do something like this:

if (isset($_REQUEST['TemplateOne']) {
  $test=$_REQUEST['TemplateOne'];
} elseif (isset($_REQUEST['TemplateTwo']) {
  $test=$_REQUEST['TemplateTwo'];
} else {
  $test="";
}

echo $test;

--

or this:
$test=0
if (isset($_REQUEST['TemplateOne']) {
  $test=1;
}
if (isset($_REQUEST['TemplateTwo']) {
  $test+=2;
}

switch ($test) {
  case 1:
  echo "one";
  break;
  case 2:
  echo "two";
  break;
  case 3:
  echo "one and two";
  break;
}

Without knowing what you're actually trying to do, however, we're all
just shooting in the dark.

--- "Miranda, Joel Louie M" <[EMAIL PROTECTED]> wrote:
> I have this php code (below), My form passes 2 values w/c is
> TemplateOne and
> TemplateTwo I was wondering how could I make that in php to catch
> the value
> as one only? I tried this and it didn't work. But if the value is
> just one
> the case display it. Any ideas?
> 
>$v_template = $_REQUEST['TemplateOne'] ;
>   $v_template = $_REQUEST['TemplateTwo'] ;
> 
> switch($v_template) {
>  case 'TemplateOne':
>  echo "one";
>  break;
> 
>  case 'TemplateTwo':
>  echo "two";
>  break;
> }
> ?>
> 
> --
> Thank you,
> Miranda, Louie
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: [PHP] 2values on form, help in catching as one.

2003-07-01 Thread Jason Sheets
You could do it a couple different ways, if you just want to combine the 
values the easiest way is:

$v_template = $_REQUEST['TemplateOne'] . $_REQUEST['TemplateTwo'];

If you want a space between the two values expand on this idea using:

$v_template = $_REQUEST['TemplateOne'] . ' ' . $_REQUEST['TemplateTwo'];

If you get a minute checkout the PHP manual at 
http://www.php.net/manual, it covers this topic and has quite a few 
useful tips in it.

Jason

Miranda, Joel Louie M wrote:

I have this php code (below), My form passes 2 values w/c is TemplateOne and
TemplateTwo I was wondering how could I make that in php to catch the value
as one only? I tried this and it didn't work. But if the value is just one
the case display it. Any ideas?

switch($v_template) {
case 'TemplateOne':
echo "one";
break;
case 'TemplateTwo':
echo "two";
break;
}
?>
--
Thank you,
Miranda, Louie
 



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


[PHP] 2values on form, help in catching as one.

2003-07-01 Thread Miranda, Joel Louie M
I have this php code (below), My form passes 2 values w/c is TemplateOne and
TemplateTwo I was wondering how could I make that in php to catch the value
as one only? I tried this and it didn't work. But if the value is just one
the case display it. Any ideas?



--
Thank you,
Miranda, Louie

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