Re: [PHP] combining variables...

2004-04-06 Thread Richard Davey
Hello Tristan,

Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

TPrsc Simply put, can I connect 2 variables, to make one...

TPrsc I want to output:
TPrsc $view_request_$i

TPrsc making for example a string:
TPrsc view_all_2

I believe it's $view_request_$$i

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] combining variables...

2004-04-06 Thread Tristan . Pretty
Sadly, it didnb't work...

here's my code... I wanna repeat and output final variables 6 times...

==

for ($i = 1; $i = 6; $i++) {

if ($view_request_bu_$i != '') {
$view_request_$i = strtolower($view_request_bu_$i);
} else if ($view_request_email_$i != '') {
$view_request_$i = strtolower($view_request_email_$i);
} else if ($view_request_company_$i != '') {
$view_request_$i = strtolower($view_request_company_$i);
} else if ($view_request_datestart_$i != '') {
$view_request_$i = date;
} else if ($view_request_filename_$i != '') {
$view_request_$i = strtolower($view_request_filename_$i);
} else if ($view_request_filecat_$i != '') {
$view_request_$i = strtolower($view_request_filecat_$i);
} else if ($view_request_filetype_$i != '') {
$view_request_$i = strtolower($view_request_filetype_$i);
} else if ($view_request_display_name_$i != '') {
$view_request_$i = 
strtolower($view_request_display_name_$i);
} else if ($view_request_region_$i != '') {
$view_request_$i = strtolower($view_request_region_$i);
} else if ($view_request_id_$i != '') {
$view_request_$i = strtolower($view_request_id_$i);
} else {
$view_request_$i = Error;
}

}

=





Richard Davey [EMAIL PROTECTED] 
06/04/2004 18:27
Please respond to
Richard Davey [EMAIL PROTECTED]


To
[EMAIL PROTECTED]
cc

Subject
Re: [PHP] combining variables...






Hello Tristan,

Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

TPrsc Simply put, can I connect 2 variables, to make one...

TPrsc I want to output:
TPrsc $view_request_$i

TPrsc making for example a string:
TPrsc view_all_2

I believe it's $view_request_$$i

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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





*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



Re: [PHP] combining variables...

2004-04-06 Thread Christian Jerono
Guess it will work this way (think it's the right syntax :-))

for ($i = 1; $i = 6; $i++) {
if (${'view_request_bu_'.$i} != '') {
...
}
}

etc pp.

Am Dienstag, 6. April 2004 19:24 schrieb [EMAIL PROTECTED]:
 Sadly, it didnb't work...

 here's my code... I wanna repeat and output final variables 6 times...

 ==

 for ($i = 1; $i = 6; $i++) {

 if ($view_request_bu_$i != '') {
 $view_request_$i = strtolower($view_request_bu_$i);
 } else if ($view_request_email_$i != '') {
 $view_request_$i = strtolower($view_request_email_$i);
 } else if ($view_request_company_$i != '') {
 $view_request_$i = strtolower($view_request_company_$i);
 } else if ($view_request_datestart_$i != '') {
 $view_request_$i = date;
 } else if ($view_request_filename_$i != '') {
 $view_request_$i = strtolower($view_request_filename_$i);
 } else if ($view_request_filecat_$i != '') {
 $view_request_$i = strtolower($view_request_filecat_$i);
 } else if ($view_request_filetype_$i != '') {
 $view_request_$i = strtolower($view_request_filetype_$i);
 } else if ($view_request_display_name_$i != '') {
 $view_request_$i =
 strtolower($view_request_display_name_$i);
 } else if ($view_request_region_$i != '') {
 $view_request_$i = strtolower($view_request_region_$i);
 } else if ($view_request_id_$i != '') {
 $view_request_$i = strtolower($view_request_id_$i);
 } else {
 $view_request_$i = Error;
 }

 }

 =





 Richard Davey [EMAIL PROTECTED]
 06/04/2004 18:27
 Please respond to
 Richard Davey [EMAIL PROTECTED]


 To
 [EMAIL PROTECTED]
 cc

 Subject
 Re: [PHP] combining variables...






 Hello Tristan,

 Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

 TPrsc Simply put, can I connect 2 variables, to make one...

 TPrsc I want to output:
 TPrsc $view_request_$i

 TPrsc making for example a string:
 TPrsc view_all_2

 I believe it's $view_request_$$i

 --
 Best regards,
  Richard Davey
  http://www.phpcommunity.org/wiki/296.html

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





 *
 The information contained in this e-mail message is intended only for
 the personal and confidential use of the recipient(s) named above.
 If the reader of this message is not the intended recipient or an agent
 responsible for delivering it to the intended recipient, you are hereby
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is
 strictly prohibited. If you have received this communication in error,
 please notify us immediately by e-mail, and delete the original message.
 ***

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



Re: [PHP] combining variables...

2004-04-06 Thread John W. Holmes
From: [EMAIL PROTECTED]
 I want to output:
 $view_request_$i

echo ${'view_request_'.$i};
echo ${view_request_$i};

Read the manual section on Variable Variables, please. 

---John Holmes...

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



Re: [PHP] combining variables...

2004-04-06 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
 Sadly, it didnb't work...
 
 here's my code... I wanna repeat and output final variables 6 times...

 
 ==
 
 for ($i = 1; $i = 6; $i++) {
 
 if ($view_request_bu_$i != '') {
 $view_request_$i = strtolower($view_request_bu_$i);
 } else if ($view_request_email_$i != '') {
 $view_request_$i = strtolower($view_request_email_$i);

You might also want to look at how you can pass variables as arrays
so you dont have to do all these needless checking.

   input name=view_request[email][]
   input name=view_request[company][]

foreach($view_request as $key = $list) {
   for ($i = 1; $i = 6; $i++) {
 if ($list[$i] != '') {
   $view_request[$key][$i] = strtolowert($list[$i]);
 } else {
   $view_request[$key][$i]  = Error;;
   $view_request_$i = 
 }
   }
}

see: http://php.net/variables.external

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] combining variables...

2004-04-06 Thread Vishal Patel
You could dynamically generate variable names using:

${view_request_}.$i} = $value;

This will generate:
$view_request_1
$view_request_2
...

Vishal.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 1:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] combining variables...


Simply put, can I connect 2 variables, to make one...

I want to output:
$view_request_$i

making for example a string:
view_all_2

But I'm getting errors..?
Parse error: parse error in /home/risk/public_html/download/results3.php 
on line 675

is there a simple explination...?


*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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

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



RE: [PHP] Combining Variables

2002-04-24 Thread Jason Soza

Well that was embarrassing. I guess [CTRL]+[ENTER] sends mail in Outlook!
Let's try that again:

Okay, I think this is an easy thing but I can't figure it out:

I have a script that will be uploading (up to) 4 files:
$file1
$file2
$file3
$file4

Each $file variable has associated $original_name, $filesize, and $filename
variables. Each file:

$original_name = $HTTP_POST_FILES['userfile1']['name'];

that gets uploaded needs to 1) have the filename modified:

$filename1 = ereg_replace([^a-z0-9._], ,
 ereg_replace ( , _,
 ereg_replace(%20, _,
 strtolower($orig_name;

2) the extension compared to a list of 'forbidden' extensions,
3) the filename compared to filenames already in existence in the upload
directory,
and 4) uploaded.

Can I do this without writing separate filename, extension, existing, and
uploading scripts? Can someone point me in the right direction here?

Thanks,
Jason Soza


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




RE: [PHP] combining variables

2001-09-12 Thread Jack Dempsey

i might be misunderstanding you, but anytime you need dynamic variable
names, you'll want variable variables...

$count = '123';
$name = count$count; # results in $name being 'count123'
$$name = 'something'; # results in $count123 = 'something'

jack

-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 12, 2001 4:52 PM
To: PHP-General
Subject: [PHP] combining variables


Hello,

I have this:
for ($i=1; $i=$num_answers; $i++) {
print bAnswer $i:/b input type=text
name='answer$i'br;
}

The user will enter the possible answers up there.  When that form is
submitted, I want to take the value from answer$i ($answer$i).  I can't do
this though.  Here's what I've done:

for ($i=1; $i=$num_answers; $i++) {
$insert_data_sql .= '$answer$i', ;
}

Everytime I do a print $answer$i, 1 is printed, or 2 is printed, or
3and so on.  So the actual value of that form field isn't printed.  Is
there any way to get around this?

Thanks,
Tyler Longren


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]