php-general Digest 18 Oct 2004 04:59:48 -0000 Issue 3059

Topics (messages 199667 through 199696):

Nested foreach ?
        199667 by: Stuart Felenstein
        199673 by: Robby Russell
        199674 by: Stuart Felenstein
        199675 by: Robby Russell
        199676 by: Stuart Felenstein
        199677 by: Robby Russell
        199678 by: Stuart Felenstein
        199679 by: John Holmes
        199680 by: Stuart Felenstein
        199681 by: Chris Dowell
        199683 by: John Holmes

Re: Tempnam not working??
        199668 by: Mark Charette
        199670 by: John Holmes

Re: PHP5 and Multi Inheritance?
        199669 by: Rory Browne

Re: Zend PHP Certification test
        199671 by: Rory Browne
        199692 by: Chris Shiflett
        199693 by: Daniel Kushner

IIS6 - CGI vs ISAPI
        199672 by: Jason Williard

Re: [PHP-DB] Question: Putting separate form elements into an array
        199682 by: Graham Cossey
        199684 by: Stuart Felenstein

cacheing problem
        199685 by: Mag
        199687 by: Greg Donald
        199691 by: Mag
        199696 by: Sagar C Nannapaneni

probs generating multiple drop down select lists within a single form
        199686 by: bruce
        199688 by: Greg Donald

Help With Error
        199689 by: php-list.xenonsolutions.com
        199690 by: Pablo Gosse

Shell commands on Windows not working
        199694 by: Tim Owens

Re: Tutorials for Maintenance of State
        199695 by: Chris Shiflett

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I have 3 arrays.  3 for 3 fields in a table (all part
of 1 record) 
array1 - field1
array2 - field2
array3 - field3

What I've been doing which works good with one array: 
if ( is_array( $_SESSION['foo'] ) ) {
        foreach ( $_SESSION['foo'] as $x ) {
sql .= "INSERT INTO TABLE (...............
         VALUES ($x)

Just can't seem to figure out how with three arrays.

help appreciated.

Stuart

--- End Message ---
--- Begin Message ---
On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein wrote:
> I have 3 arrays.  3 for 3 fields in a table (all part
> of 1 record) 
> array1 - field1
> array2 - field2
> array3 - field3
> 
> What I've been doing which works good with one array: 
> if ( is_array( $_SESSION['foo'] ) ) {
>       foreach ( $_SESSION['foo'] as $x ) {
> sql .= "INSERT INTO TABLE (...............
>          VALUES ($x)
> 
> Just can't seem to figure out how with three arrays.
> 
> help appreciated.
> 
> Stuart
> 

Can you provide a print_r() output of your $_SESSION['foo'] ?

I can help you more after that.

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
Robby

Here is the printout :
Using-
print_r ($skills);
print_r ($skys);
print_r ($slus);


Array ( [0] => skillone [1] => skilltwo [2] =>
skillthree [3] => [4] => ) Array ( [0] => 2 [1] => 3
[2] => 4 [3] => [4] => ) Array ( [0] => [1] => [2] =>
[3] => [4] => ) 1

FYI - The skills is a string, skys and slus ints. 
Also I had only filled in 3 of the 5 for each.

Thank you 
Stuart

--- Robby Russell <[EMAIL PROTECTED]> wrote:

> On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein
> wrote:
> > I have 3 arrays.  3 for 3 fields in a table (all
> part
> > of 1 record) 
> > array1 - field1
> > array2 - field2
> > array3 - field3
> > 
> > What I've been doing which works good with one
> array: 
> > if ( is_array( $_SESSION['foo'] ) ) {
> >     foreach ( $_SESSION['foo'] as $x ) {
> > sql .= "INSERT INTO TABLE (...............
> >          VALUES ($x)
> > 
> > Just can't seem to figure out how with three
> arrays.
> > 
> > help appreciated.
> > 
> > Stuart
> > 
> 
> Can you provide a print_r() output of your
> $_SESSION['foo'] ?
> 
> I can help you more after that.
> 
> -Robby
> 
> -- 
> /***************************************
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON  | www.planetargon.com
> * Portland, OR  | [EMAIL PROTECTED]
> * 503.351.4730  | blog.planetargon.com
> * PHP/PostgreSQL Hosting & Development
> ****************************************/
> 
> 

> ATTACHMENT part 2 application/pgp-signature
name=signature.asc

--- End Message ---
--- Begin Message ---
On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein wrote:
> Robby
> 
> Here is the printout :
> Using-
> print_r ($skills);
> print_r ($skys);
> print_r ($slus);
> 
> 
> Array ( [0] => skillone [1] => skilltwo [2] =>
> skillthree [3] => [4] => ) Array ( [0] => 2 [1] => 3
> [2] => 4 [3] => [4] => ) Array ( [0] => [1] => [2] =>
> [3] => [4] => ) 1
> 
> FYI - The skills is a string, skys and slus ints. 
> Also I had only filled in 3 of the 5 for each.
> 
> Thank you 
> Stuart

Are these 3 arrays related somehow? are all the [0]'s related and all
the [1]'s related in each array?

If so, you might consider having an array of arrays

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
They are related in the sense that they are part of
one record in the database.  
Fields
Skill   YearsUsed   LastUsed

When you say array of arrays you are referring to a
multi-dimensional ?  I'm not sure what you mean by 
are the [0] related.

Thank you,
Stuart
--- Robby Russell <[EMAIL PROTECTED]> wrote:

> On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein
> wrote:
> > Robby
> > 
> > Here is the printout :
> > Using-
> > print_r ($skills);
> > print_r ($skys);
> > print_r ($slus);
> > 
> > 
> > Array ( [0] => skillone [1] => skilltwo [2] =>
> > skillthree [3] => [4] => ) Array ( [0] => 2 [1] =>
> 3
> > [2] => 4 [3] => [4] => ) Array ( [0] => [1] => [2]
> =>
> > [3] => [4] => ) 1
> > 
> > FYI - The skills is a string, skys and slus ints. 
> > Also I had only filled in 3 of the 5 for each.
> > 
> > Thank you 
> > Stuart
> 
> Are these 3 arrays related somehow? are all the
> [0]'s related and all
> the [1]'s related in each array?
> 
> If so, you might consider having an array of arrays
> 
> -Robby
> 
> -- 
> /***************************************
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON  | www.planetargon.com
> * Portland, OR  | [EMAIL PROTECTED]
> * 503.351.4730  | blog.planetargon.com
> * PHP/PostgreSQL Hosting & Development
> ****************************************/
> 
> 

> ATTACHMENT part 2 application/pgp-signature
name=signature.asc

--- End Message ---
--- Begin Message ---
On Sun, 2004-10-17 at 13:08 -0700, Stuart Felenstein wrote:
> They are related in the sense that they are part of
> one record in the database.  
> Fields
> Skill   YearsUsed   LastUsed
> 
> When you say array of arrays you are referring to a
> multi-dimensional ?  I'm not sure what you mean by 
> are the [0] related.
> 
> Thank you,
> Stuart

I guess that I am just trying to figure out what your issue is.

Can you explain what the issue is a bit more, in plain english and
perhaps I can help you from there.

All I can see right now is that you are having an issue with a nested
foreach, but didn't really explain what the issue was.

-Robby


-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
Okay, I will try -

I have these three fields in a form for user input.
There are 10 sets of these, i.e. Users can enter three
sets of skills, with the yearsused and when last used.

I have set them up as arrays, since it's probably not
wise to manage 30 seperate variables.

I'm using session variables:

$_SESSION['skills'] = $_POST['skill']; 
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu'];

My problem is I do not know how to get these into the
database with one query.

Hope this is clearer.

Thank you ,
Stuart






--- Robby Russell <[EMAIL PROTECTED]> wrote:

> On Sun, 2004-10-17 at 13:08 -0700, Stuart Felenstein
> wrote:
> > They are related in the sense that they are part
> of
> > one record in the database.  
> > Fields
> > Skill   YearsUsed   LastUsed
> > 
> > When you say array of arrays you are referring to
> a
> > multi-dimensional ?  I'm not sure what you mean by
> 
> > are the [0] related.
> > 
> > Thank you,
> > Stuart
> 
> I guess that I am just trying to figure out what
> your issue is.
> 
> Can you explain what the issue is a bit more, in
> plain english and
> perhaps I can help you from there.
> 
> All I can see right now is that you are having an
> issue with a nested
> foreach, but didn't really explain what the issue
> was.
> 
> -Robby
> 
> 
> -- 
> /***************************************
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON  | www.planetargon.com
> * Portland, OR  | [EMAIL PROTECTED]
> * 503.351.4730  | blog.planetargon.com
> * PHP/PostgreSQL Hosting & Development
> ****************************************/
> 
> 

> ATTACHMENT part 2 application/pgp-signature
name=signature.asc

--- End Message ---
--- Begin Message ---
Stuart Felenstein wrote:

Here is the printout :
Using-
print_r ($skills);
print_r ($skys);
print_r ($slus);


Array ( [0] => skillone [1] => skilltwo [2] => skillthree [3] => [4] => ) Array ( [0] => 2 [1] => 3 [2] => 4 [3] => [4] => ) Array ( [0] => [1] => [2] => [3] => [4] => ) 1

FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each.

Since we're just guessing at what you want, I'll guess something like this:

foreach($skills as $key => $skill)
{
  echo "$skill - {$skys[$key]} - {$slus[$key]}\n";
}

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
John, 

Sorry, I'm not trying to be unclear.
There are 3 columns in the table.
In the user form. there are 30 fields, 10 text and 20
dropdown.

The 10 text are:
$_SESSION['skills'] = $_POST['skill']; 
The first dropdown is :
$_SESSION['skys'] = $_POST['sky']; 
The second dropdown is:
$_SESSION['slus'] = $_POST['slu']; 

So I need to grab the input and
enter into database 
where each set of skill, sky , slu is a new record.

I hope this is clearer.

Stuart
--- John Holmes <[EMAIL PROTECTED]> wrote:

> Stuart Felenstein wrote:
> 
> > Here is the printout :
> > Using-
> > print_r ($skills);
> > print_r ($skys);
> > print_r ($slus);
> > 
> > 
> > Array ( [0] => skillone [1] => skilltwo [2] =>
> > skillthree [3] => [4] => ) Array ( [0] => 2 [1] =>
> 3
> > [2] => 4 [3] => [4] => ) Array ( [0] => [1] => [2]
> =>
> > [3] => [4] => ) 1
> > 
> > FYI - The skills is a string, skys and slus ints. 
> > Also I had only filled in 3 of the 5 for each.
> 
> Since we're just guessing at what you want, I'll
> guess something like this:
> 
> foreach($skills as $key => $skill)
> {
>    echo "$skill - {$skys[$key]} - {$slus[$key]}\n";
> }
> 
> -- 
> 
> ---John Holmes...
> 
> Amazon Wishlist:
> www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals –
> www.phparch.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Stuart,

Having read what you've written so far, you may want to try something like this.

In your HTML (I've left the selects empty, but you can see what I mean):




<input type="text" name="skills[0][name]" /><select name="skills[0][years]" /><select name="skills[0][used]" />

<input type="text" name="skills[1][name]" /><select name="skills[1][years]" /><select name="skills[1][used]" />

<input type="text" name="skills[2][name]" /><select name="skills[2][years]" /><select name="skills[2][used]" />

...

<input type="text" name="skills[9][name]" /><select name="skills[9][years]" /><select name="skills[9][used]" />



Then in PHP

<?php

foreach ($_POST['skills'] as $skill)
{
 $skillname = $skill['name'];
 $yearsused = $skill['years'];
 $lastused = $skill['used'];
 ...
}

?>

Hope this helps

Cheers

Chris
--- End Message ---
--- Begin Message ---
Stuart Felenstein wrote:

John,

Sorry, I'm not trying to be unclear.
There are 3 columns in the table.
In the user form. there are 30 fields, 10 text and 20
dropdown.

The 10 text are:
$_SESSION['skills'] = $_POST['skill']; The first dropdown is :
$_SESSION['skys'] = $_POST['sky']; The second dropdown is:
$_SESSION['slus'] = $_POST['slu'];

So I need to grab the input and
enter into database where each set of skill, sky , slu is a new record.

I hope this is clearer.

Did you read the answer I gave?

foreach($skills as $key => $skill)
{
  echo "$skill - {$skys[$key]} - {$slus[$key]}\n";
}

Now adapt that to your session variables and query:

foreach($_SESSION['skills'] as $key => $skill)
{
$query = "INSERT INTO table (skill, sky, sku) VALUES ('$skill', {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]})";
//run query
}

or, if you can use extended inserts:

$insert = array();
foreach($_SESSION['skills'] as $key => $skill)
{ $insert[] = "('$skill',{$_SESSION['skys'][$key]},{$_SESSION['skus'][$key]})";
}
$query = 'INSERT INTO table (skill,sky,sku) VALUES ' . implode(',',$insert);
//run query

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message --- ----- Original Message ----- From: "Brent Clements" <[EMAIL PROTECTED]>

When I run the following

$fname = tempnam('mytmp/', 'PREFIX_');

and then echo $fname, it returns

/tmp/FILENAME rather than mytmp/FILENAME
----------
From the manual:

Creates a file with a unique filename in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that

The chances are that mytmp in the directory the script is runjning in either doesn't exist or is not writable by the process running on the server.
--- End Message ---
--- Begin Message --- Brent Clements wrote:
Hi Everybody,

I'm running php 4.3.2

When I run the following

$fname = tempnam('mytmp/', 'PREFIX_');

and then echo $fname, it returns

/tmp/FILENAME rather than mytmp/FILENAME

I'm running under RHEL 3 U3

Anybody know what's going on?

If 'mytmp' does not exist (relative to your script), then PHP will default to the system directory. Or, if PHP cannot write to 'mytmp', it'll default back to the system temporary directory.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
I'm not sure, but I think the only way you are going to get MI in PHP,
is if you implement if yourself. By this I mean, implementing the
correct __get(), __set(), and __call() functions.



On Sun, 17 Oct 2004 18:32:34 +0400, M Saleh EG <[EMAIL PROTECTED]> wrote:
> Thanx Mathew
> I guess I found it, it's disapointing though.
> 
> Here was the answer: http://www.zend.com/php5/andi-book-excerpt.php#Heading3
> 
> <Copied from the link above>
> 4. Interfaces
> Gives the ability for a class to fulfill more than one is-a
> relationships. A class can inherit from one class only but may
> implement as many interfaces as it wants.
> <Copied from the link above>
> 
> On 17 Oct 2004 13:30:36 -0000, Matthew Weier O'Phinney
> 
> 
> <[EMAIL PROTECTED]> wrote:
> > * M Saleh Eg <[EMAIL PROTECTED]>:
> > > Is direct multi inhertance supported in PHP5?
> >
> > I believe so -- this was one of the new features of the object model
> > introduced in PHP5. My understanding is that you have to create
> > interface classes that a class can then implement. Unfortunately,
> > interface classes are abstract -- no code allowed other than
> > declarations.
> >
> > > I'm on PHP4, didnt find this on the docs nor at zend's. It might be
> > > the reason of migrating to PHP5 for me. Any Idea? anyone who tested
> > > it? by this I dont mean the chaining method of inheriting. I mean
> > > direct multi inheritance!
> >
> > I saw a number of mentions of it when PHP5 was first released, but the
> > only reference I can dig up now is at:
> >
> >    http://www.zend.com/php5/andi-book-excerpt.php#Heading3
> >
> > and, unfortunately, when it talks about interfaces being how multiple
> > inheritance is achieved, fails to give an example.
> >
> > Surely somebody has a more definitive answer, but I thought I'd give it
> > a shot.
> >
> > --
> > Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
> > Webmaster and IT Specialist       | http://www.garden.org
> > National Gardening Association    | http://www.kidsgardening.com
> > 802-863-5251 x156                 | http://nationalgardenmonth.org
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
> M.Saleh.E.G
> 97150-4779817
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I've been looking all over the Zend Cert site, trying to find the
passing rate, ie how many questions I have to get right in order to
pass.

Is this information secret, or have I just not looked in the right place.

If it's the latter, please enlighten me.

Thanks
Rory

--- End Message ---
--- Begin Message ---
--- Rory Browne <[EMAIL PROTECTED]> wrote:
> I've been looking all over the Zend Cert site, trying to find the
> passing rate, ie how many questions I have to get right in order
> to pass.
> 
> Is this information secret, or have I just not looked in the right
> place.

It's not public information.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
Coming December 2004        http://httphandbook.org/

--- End Message ---
--- Begin Message ---
Hi Rory,

The passing score is not revealed. There is only a pass/fail on the test.

Best,
Daniel Kushner



On Sun, 17 Oct 2004 19:08:32 +0100, Rory Browne <[EMAIL PROTECTED]> wrote:
> I've been looking all over the Zend Cert site, trying to find the
> passing rate, ie how many questions I have to get right in order to
> pass.
> 
> Is this information secret, or have I just not looked in the right place.
> 
> If it's the latter, please enlighten me.
> 
> Thanks
> Rory
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I am running a Windows 2003 web server with IIS 6.  I currently have PHP 
4.3.8 installed as CGI and it is almost working perfectly.  Occasionally, I 
get the following error:  "No input file specified."  I will be upgrading to 
4.3.9 soon and am considering switching to ISAPI.  I have heard good and bad 
things from people who I feel are not quite informed.  I would like to know 
your opinion on the matter.

Which is a better option for IIS6?  What are the upsides and downsides to 
each?

-- 

Thank You,
Jason Williard

--- End Message ---
--- Begin Message ---
Stuart, now I'm confused.

You seem to be posting slightly different versions of problems relating to
the same script(s) on 2 lists.

What is the current situation? Iterating through the 3 arrays or inserting
into MySQL?

Graham

> -----Original Message-----
> From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
> Sent: 17 October 2004 16:14
> To: Stuart Felenstein; Graham Cossey; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Question: Putting separate form elements into an
> array
>
>
> Changed my direction somewhat but keep getting a parse
> error and although I know where it is , I can't seem
> to figure out what I need to do to make it syntax
> correct:
>
[snip]

--- End Message ---
--- Begin Message ---
Sorry about the two lists.  The echo's are fine.  The
problem was iterating through the 3 arrays.

Stuart
--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> Stuart, now I'm confused.
> 
> You seem to be posting slightly different versions
> of problems relating to
> the same script(s) on 2 lists.
> 
> What is the current situation? Iterating through the
> 3 arrays or inserting
> into MySQL?
> 
> Graham
> 
> > -----Original Message-----
> > From: Stuart Felenstein
> [mailto:[EMAIL PROTECTED]
> > Sent: 17 October 2004 16:14
> > To: Stuart Felenstein; Graham Cossey;
> [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Question: Putting separate
> form elements into an
> > array
> >
> >
> > Changed my direction somewhat but keep getting a
> parse
> > error and although I know where it is , I can't
> seem
> > to figure out what I need to do to make it syntax
> > correct:
> >
> [snip]
> 
> 
> 

--- End Message ---
--- Begin Message ---
Hi,
Heres my problem:
I am offering a form for the client to upload his
picture, then his pic is shown and he can pick some
text to write on the image, then I am using GD to
write the text.
If the client does not like the position of the text
he can press the back button and change the position,
but this seems to be working only in Opera....in IE it
is displaying this horrorable text:

Warning: Page has Expired 

The page you requested was created using information
blah balh blah blah

What headers or whatever do I have to set so that it
shows the cached page?
please show me where and how to set the headers or
whatever :-)

Thanks,
Mag

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
> Warning: Page has Expired

You can use the GET method instead of POST in your form if that's appropriate.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Hi,
I dont really have a problem in converting from POST
to GET but the html FILE box does not post its
variables if it is not in POST

eg:
<input type=file name=upload>

if you do a submit with $_GET the $_FILES array will
be "" or not existant

How to pass that?

Thanks,
Mag


--- Greg Donald <[EMAIL PROTECTED]> wrote:

> On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > Warning: Page has Expired
> 
> You can use the GET method instead of POST in your
> form if that's appropriate.
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
You have some restriction on the size of the data u send
through GET method.. like i remember it as 256Kb or so.
So if u r sending data larger than this limit ...u need to use the post
method

/sagar
----- Original Message -----
From: "Mag" <[EMAIL PROTECTED]>
To: "Greg Donald" <[EMAIL PROTECTED]>; "php php"
<[EMAIL PROTECTED]>
Sent: Monday, October 18, 2004 7:59 AM
Subject: Re: [PHP] cacheing problem


> Hi,
> I dont really have a problem in converting from POST
> to GET but the html FILE box does not post its
> variables if it is not in POST
>
> eg:
> <input type=file name=upload>
>
> if you do a submit with $_GET the $_FILES array will
> be "" or not existant
>
> How to pass that?
>
> Thanks,
> Mag
>
>
> --- Greg Donald <[EMAIL PROTECTED]> wrote:
>
> > On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag
> > <[EMAIL PROTECTED]> wrote:
> > > Warning: Page has Expired
> >
> > You can use the GET method instead of POST in your
> > form if that's appropriate.
> >
> >
> > --
> > Greg Donald
> > Zend Certified Engineer
> > http://gdconsultants.com/
> > http://destiney.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> =====
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
hi...

i have a prob/issue that i can't see.. i'm trying to geneate a page with
multiple lists so that the user has to select an item from all 3 lists in
order to access the next page...

the 1st select/list allows the user to select either one or more items. the
2nd/3rd select lists require the user to select only a single item from the
lists.

ie:
    list1          list2        list3      >submitBTN<

the user would select the items from all three lists, and hit the selectBTN,
to go to the next page...

the prob that i'm having is that if i simply select item(s) from the 1st
list, then the code allows the user to continue...in other words, the app
looks as though the user has selected an item from the 2nd/3rd even though
they haven't been selected... in examining the code, it appears that the
last item in the 2nd/3rd lists is being somehow read/inserted into the
items, and are somehow included in the querystring...

my code is:

   /*
      generate the state list
   */
   echo"
      <div style='position:absolute; top:320px; left:50px; width:400px;'>
      <form name='test' method='get' action='$foo.php'>
      <div style='position:relative; top:10px; left:10px;'>
      <select multiple size=10 name='state[]'>
   ";

      $state_query = "select * from stateTBL";
      $res = mysqli_query($link, $state_query);
      //$res = mysql_query($query);

      //go ahead and process/populate the drop down
      //menu
      echo "<option value ='*'>All States</option>\n";
      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
      {
         echo "<option value
='".$row['val']."'>".$row['name']."</option>\n";

      }

   echo"
      </select>
      </div>
   ";


   /*
      generate the year list
   */
   echo"
      <div style='position:absolute; top:10px; left:240px; width:100px;'>
      <select  multiple size=1 name= 'year'>
   ";

      $year_query = "select * from yearTBL";
      $res = mysqli_query($link, $year_query);
      //$res = mysql_query($query);

      //go ahead and process/populate the drop down
      //menu
      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
      {
         echo "<option value
='".$row['year']."'>".$row['year']."</option>\n";
      }

   echo"
      </select>
      </div>
   ";


   /*
      generate the terms list
   */
   echo"
      <div style='position:absolute; top:10px; left:325px; width:100px;'>
      <select name= 'term'>
   ";

      $term_query = "select * from termTBL";
      $res = mysqli_query($link, $term_query);
      //$res = mysql_query($query);

      //go ahead and process/populate the drop down
      //menu
      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
      {
         echo "<option value ='".$row['ID']."'>".$row['term']."</option>\n";
      }

   echo"
      </select>
      </div>
   ";

   $blah = $userdata['session_id'];

   echo"
      <div style='position:relative; top:-150px; left:475px;'>
      <input type='submit' name='sub1' value='submit'>
      </div>
      <input type ='hidden' name='sid' value='$blah'>
      <input type='hidden' name='display' value='state'>
      </form>
      </div>
   ";


in foo.php, i simply display the $_GET['state'], $_GET['year'],$_GET['term']
vars to see what they are...

if i make all the select vars for the query terms arrays, it works as it
should, in that if all three lists aren't selected, then the user can't
proceed. however, if i use the select <select name = 'foo'> for the 2nd/3rd
lists, then the logic screws up...

any idea why this is occuring....

is there a better way/example of using multiple drop down lists within a
single form.....

any thoughts/comments/pointers would be helpful.. i'm pretty sure that the
issue/prob is rather straight forward/simple, but i can't see it right
now....

thanks...

-bruce

--- End Message ---
--- Begin Message ---
On Sun, 17 Oct 2004 17:23:14 -0700, bruce <[EMAIL PROTECTED]> wrote:
> i have a prob/issue that i can't see.. i'm trying to geneate a page with
> multiple lists so that the user has to select an item from all 3 lists in
> order to access the next page...
> 
> the 1st select/list allows the user to select either one or more items. the
> 2nd/3rd select lists require the user to select only a single item from the
> lists.
> 
> ie:
>    list1          list2        list3      >submitBTN<
> 
> the user would select the items from all three lists, and hit the selectBTN,
> to go to the next page...
> 
> the prob that i'm having is that if i simply select item(s) from the 1st
> list, then the code allows the user to continue...in other words, the app
> looks as though the user has selected an item from the 2nd/3rd even though
> they haven't been selected... in examining the code, it appears that the
> last item in the 2nd/3rd lists is being somehow read/inserted into the
> items, and are somehow included in the querystring...
> 
> my code is:
> 
>   /*
>      generate the state list
>   */
>   echo"
>      <div style='position:absolute; top:320px; left:50px; width:400px;'>
>      <form name='test' method='get' action='$foo.php'>

Why $foo here?  Maybe not enough context for me to understand the
reason, I dunno.

>      <div style='position:relative; top:10px; left:10px;'>
>      <select multiple size=10 name='state[]'>
>   ";
> 
>      $state_query = "select * from stateTBL";
>      $res = mysqli_query($link, $state_query);
>      //$res = mysql_query($query);
> 
>      //go ahead and process/populate the drop down
>      //menu
>      echo "<option value ='*'>All States</option>\n";
>      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
>      {
>         echo "<option value
> ='".$row['val']."'>".$row['name']."</option>\n";
> 
>      }
> 
>   echo"
>      </select>
>      </div>
>   ";
> 
>   /*
>      generate the year list
>   */
>   echo"
>      <div style='position:absolute; top:10px; left:240px; width:100px;'>
>      <select  multiple size=1 name= 'year'>
>   ";

Did you mean year[] here?  Otherwise why multiple?

>      $year_query = "select * from yearTBL";
>      $res = mysqli_query($link, $year_query);
>      //$res = mysql_query($query);
> 
>      //go ahead and process/populate the drop down
>      //menu
>      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
>      {
>         echo "<option value
> ='".$row['year']."'>".$row['year']."</option>\n";
>      }
> 
>   echo"
>      </select>
>      </div>
>   ";
> 
>   /*
>      generate the terms list
>   */
>   echo"
>      <div style='position:absolute; top:10px; left:325px; width:100px;'>
>      <select name= 'term'>
>   ";
> 
>      $term_query = "select * from termTBL";
>      $res = mysqli_query($link, $term_query);
>      //$res = mysql_query($query);
> 
>      //go ahead and process/populate the drop down
>      //menu
>      while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
>      {
>         echo "<option value ='".$row['ID']."'>".$row['term']."</option>\n";
>      }
> 
>   echo"
>      </select>
>      </div>
>   ";
> 
>   $blah = $userdata['session_id'];
> 
>   echo"
>      <div style='position:relative; top:-150px; left:475px;'>
>      <input type='submit' name='sub1' value='submit'>
>      </div>
>      <input type ='hidden' name='sid' value='$blah'>
>      <input type='hidden' name='display' value='state'>
>      </form>
>      </div>
>   ";
> 
> in foo.php, i simply display the $_GET['state'], $_GET['year'],$_GET['term']
> vars to see what they are...
> 
> if i make all the select vars for the query terms arrays, it works as it
> should, in that if all three lists aren't selected, then the user can't
> proceed. however, if i use the select <select name = 'foo'> for the 2nd/3rd
> lists, then the logic screws up...
> 
> any idea why this is occuring....
> 
> is there a better way/example of using multiple drop down lists within a
> single form.....

Possibly.  I'd recommend using print_r($_GET) to see your form
submissions.  To make sure your actually getting what you want to be
getting.

> any thoughts/comments/pointers would be helpful.. i'm pretty sure that the
> issue/prob is rather straight forward/simple, but i can't see it right
> now....

Not sure exactly what is broken, is that your entire script as posted?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Hello Everyone,

I keep getting the following errors in my class and I don't know why. Maybe
something has changed in PHP 5.x that I don't know about? Here are the
errors and the methods of that class:

-----------------------
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Fatal error: Cannot use object of type DB_Error as array in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
46
-----------------------


Line 77 is the 5th line of the following function:


-----------------------
    function get_ancestors($child) {
        // get child's lft & rgt values
        $data = $this->get_cat_coord($child);
        // get ancestors of child based on child's lft and rgt values
        $tree = $this->fetch('SELECT * FROM tree WHERE lft <
'.$data['0']['lft'].' AND rgt > '.$data['0']['rgt'].' ORDER BY lft ASC');
        return $tree;
    }
-----------------------


Line 46 is the 3rd line of the following function


-----------------------
    function get_parent($child) {
        $parent = $this->get_ancestors($child);
        $parent = $parent[count($parent)-1];
        if (count($parent) > 0) {
            return $parent;
        } else {
            return 0;
        }
    }
-----------------------


I am calling the following function which calls the other two child
functions above:


-----------------------
    function add_cat($cat, $addAfterCat_name='', $addAfterCat_lft='') {
        if (!$this->exists_in_category($cat, $addAfterCat_name)) {
            $db = $this->dbconnect();
            if ($cat != '' && $addAfterCat_lft != '') {
                $db->query("UPDATE tree SET rgt=rgt+2 WHERE
rgt>".$addAfterCat_lft);
                $db->query("UPDATE tree SET lft=lft+2 WHERE
lft>".$addAfterCat_lft);
                $add_query = "INSERT INTO tree SET lft='";
                $add_query .= $addAfterCat_lft+1;
                $add_query .= "', rgt='";
                $add_query .= $addAfterCat_lft+2;
                $add_query .= "', category='$cat'";
                echo $add_query;
                $db->query($add_query);
                $message = 'Category Added To Tree';
            } elseif ($cat != '' && $addAfterCat_lft == '') {
                $message = 'Please Input A Category To Add';
            } elseif ($cat == '' && $addAfterCat_lft != '') {
                $message = 'Please Choose A Category To Add This Category
To';
            }
        } else {
            $message = 'Category Already Exists In The Parent Category';
        }
        return $message;
    }
-----------------------

What am I doing wrong?

--- End Message ---
--- Begin Message ---
[snip]
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on
line
77
[/snip]

It's telling you that $data['0'], which is used twice in your query, is
not a valid index (ie. it doesn't exist) for the $data array.

Why don't you dump the $data array after it is set to see where the
problem is:

$data = $this->get_cat_coord($child);
print_r($data);
die();

Take a look at what comprises the $data array and you should find your
problem.

HTH,

Pablo

--- End Message ---
--- Begin Message ---
We have a client using a Windows system:

PHP 4.3.4
Windows NT WEBSERVER 5.2 build 3790

I'm attempting to use exec() to run a system command. I don't seem to be
able to call any command, or at least I don't see any output.

Indeed, the following produces nothing:

echo `dir`; //i.e. backticks

It works happily on my laptop. They have safe mode off. The PHP manual
talks about shell_exec needing to be enabled, but doesn't give any clue
how.

Any clues?


Tim Owens
Dataview Design Ltd
- innovative & quality web automation -

--- End Message ---
--- Begin Message ---
--- GH <[EMAIL PROTECTED]> wrote:
> I know about sessions... but I am even more concerened now about
> the use of cookies but I am not 100% sure on how to accomplish
> this....

When you say you are concerned about cookies, what do you mean exactly?

When used properly, cookies can afford a heightened level of security to
users whose preferences allow them. Because they were created with the
specific purpose of adding state to HTTP, they tend to address this
problem the best.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
Coming December 2004        http://httphandbook.org/

--- End Message ---

Reply via email to