php-windows Digest 23 Nov 2004 03:36:10 -0000 Issue 2479
Topics (messages 25013 through 25026):
'Unable to load' extension dll if VS.net 2003 not installed
25013 by: Tang, Ming-Chung
25025 by: Edin Kadribasic
Insert keys into an array using variables
25014 by: Rafael Soares
25019 by: Wagner, Aaron
Re: How can I?
25015 by: Gryffyn, Trevor
25016 by: Tony Devlin
25017 by: Gryffyn, Trevor
25018 by: Tony Devlin
25020 by: Gryffyn, Trevor
Passing an Array in HTML
25021 by: MikeA
25022 by: Vail, Warren
25023 by: MikeA
25024 by: Vail, Warren
What's wrong with these two programs?
25026 by: aomarlow
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 ---
-----Original Message-----
From: Tang, Ming-Chung [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 10:50 PM
To: '[EMAIL PROTECTED]'
Subject: 'Unable to load' extension dll if VS.net 2003 not installed
Hi all,
I followed the great intro '
<http://www.devarticles.com/c/a/Cplusplus/Developing-Custom-PHP-Extensio
ns-Part-1/> Developing Custom PHP Extensions: Part 1' and successfully
built a php_devarticlesmod.dll on my winXP using VS.net 2003, and
everything works fine.
But when I try to use the built dll on another winXP computer (VS.net
2003 is not installed) by directly copying the whole, same directories
from my winXP (including apache1331 and php436 & php436src, and
php.ini), I got the error message: 'Unable to load dynamic library
.php_devarticlesmod.dll'. Then I uncommented 'php_gd.dll and
php_ming.dll' in PHP.ini; the system can find them and both can be shown
in the page by using 'phpinfo();'. So it's not a problem of PATH since
they are all located in the same extension dir.
I also tried to copy all dll's in PHP related DIRs to c:\windows or
system, or system32 and tried to add PHP related DIRs to system PATH,
but still got the same error message.
Finally, I get another winXP computer with VS.net 2003 installed and try
again (without building the dll again), and it works this time. So I
think the extension module I built is somehow dependant on something of
VS.net 2003, but I don't know why. Could someone please give me a hint
to resolve this?
Regards,
Paulkk,
--- End Message ---
--- Begin Message ---
Hi,
You are right, VS.net 2003 compiles all dlls against a newer version of C
runtime (msvcrt7.dll). You can check this by running "depends
php_devarticlesmod.dll" or double clicking on it on a machine that has
VS.net installed.
Edin
"Ming-Chung Tang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Tang, Ming-Chung [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 10:50 PM
> To: '[EMAIL PROTECTED]'
> Subject: 'Unable to load' extension dll if VS.net 2003 not installed
>
> Hi all,
>
> I followed the great intro '
> <http://www.devarticles.com/c/a/Cplusplus/Developing-Custom-PHP-Extensio
> ns-Part-1/> Developing Custom PHP Extensions: Part 1' and successfully
> built a php_devarticlesmod.dll on my winXP using VS.net 2003, and
> everything works fine.
> But when I try to use the built dll on another winXP computer (VS.net
> 2003 is not installed) by directly copying the whole, same directories
> from my winXP (including apache1331 and php436 & php436src, and
> php.ini), I got the error message: 'Unable to load dynamic library
> .php_devarticlesmod.dll'. Then I uncommented 'php_gd.dll and
> php_ming.dll' in PHP.ini; the system can find them and both can be shown
> in the page by using 'phpinfo();'. So it's not a problem of PATH since
> they are all located in the same extension dir.
> I also tried to copy all dll's in PHP related DIRs to c:\windows or
> system, or system32 and tried to add PHP related DIRs to system PATH,
> but still got the same error message.
> Finally, I get another winXP computer with VS.net 2003 installed and try
> again (without building the dll again), and it works this time. So I
> think the extension module I built is somehow dependant on something of
> VS.net 2003, but I don't know why. Could someone please give me a hint
> to resolve this?
>
> Regards,
> Paulkk,
>
--- End Message ---
--- Begin Message ---
Hello!
I have a script that gets some _POST variables (all, except some ones
specified in an array) and puts into another array, to use them in an e-mail
message later.
But the script needs to catch ANY vars, like I don't know which vars will be
sent in _POST.
This script will show it better:
<?
$exception = array("var1","var2","var3") // these are the variables I don't
want to catch
$array = array(); // the array to put the variables into
while (list($key,$value) = each($_POST)) {
if (in_array($key,$exception))
$$key = $value;
else // here is the problem... How can I use the variable $key to
add keys into the array??
$array[$key] = $value; // I also tried $array[&$key] =
$value but it didn't work
}
?>
Later in the message, I'll use this loop:
<?
while (list($field,$data) = each($array)){
$msg .= "- " . $field . ": " . $data . "\n";
}
?>
I can't realize how I can do this...
Thanks in advance.
Rafael Soares - AgênciaM
Fone: +55 11 4616-1394
--- End Message ---
--- Begin Message ---
try this..
<?
$exception = array("var1","var2","var3") // these are the
variables I don't
want to catch
$array = array(); // the array to put the variables into
while (list($key,$value) = each($_POST)) {
if (in_array($key,$exception)){
$$key = $value;
}else{
$array = array_merge($array, array($key=>$value));
}
}
?>
$stack = array_merge($stack, array("one"=>"test"));
Aaron N Wagner
WagnerWebDesign.net
> -----Original Message-----
> From: Rafael Soares [mailto:[EMAIL PROTECTED]
> Sent: November 22, 2004 10:58
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Insert keys into an array using variables
>
>
> Hello!
>
> I have a script that gets some _POST variables (all, except some ones
> specified in an array) and puts into another array, to use
> them in an e-mail
> message later.
>
> But the script needs to catch ANY vars, like I don't know
> which vars will be
> sent in _POST.
>
> This script will show it better:
>
> <?
>
> $exception = array("var1","var2","var3") // these are the
> variables I don't
> want to catch
> $array = array(); // the array to put the variables into
>
> while (list($key,$value) = each($_POST)) {
> if (in_array($key,$exception))
> $$key = $value;
> else // here is the problem... How can I use the
> variable $key to
> add keys into the array??
> $array[$key] = $value; // I also tried $array[&$key] =
> $value but it didn't work
> }
>
> ?>
>
> Later in the message, I'll use this loop:
>
> <?
>
> while (list($field,$data) = each($array)){
> $msg .= "- " . $field . ": " . $data . "\n";
> }
>
> ?>
>
> I can't realize how I can do this...
>
> Thanks in advance.
>
> Rafael Soares - AgênciaM
> Fone: +55 11 4616-1394
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I'm not quite sure what you're asking for here, but let me take a shot:
Do you want the scripts in, say, your index.php's to know what folder
they're in and act accordingly?
So you'd essentially have exactly the same index.php in every folder,
but they would do different things depending on if they were in
/company/ or in /customer/ or in /tips/?
If so, you could get the SCRIPT_NAME from the server variables, then use
the dirname() function and some parsing to get the last directory name
in the path. But that seems to lead to the "too many SWITCH statements"
thing that you're trying to avoid.
Maybe if you could clarify what you're trying to do, it might help us
determine the best course of action.
-TG
> -----Original Message-----
> From: Tony Devlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 9:20 AM
>
> Onto the real question. I'm trying to make a switch
> statement that switches a header file based upon
> what folder you are in...
>
> An example:
>
> Let's say I have 3 folders with some files inside.
>
> /company/
> --> index.php
> --> contact.php
>
> /customer/
> --> index.php
> --> profile.php
>
> /tips/
> --> index.php
>
>
> Basically instead of building a huge switch with EVERY full
> path file name included, I want to just make a switch based
> on folder, then every file inside that folder will have
> the switch applied to it. I am sure this is
> possible, anyone have any ideas about how to do this?
>
> Greatly appreciated,
>
> Tony Devlin
>
--- End Message ---
--- Begin Message ---
The reasoning for this is so that I can apply different stylesheets and
formatting to different pages inside a specific site. The entire site is
dynamic and changeable, they can add pages/subtract pages, etc.. so the
layout information needs to be controlled on the header page, the only
static/untouchable page.
Let's say everything in compayn folder is blue text, but I want everything
in the customer folder to be green text. How do you control that when you
have dynamic pages? .. easy you find a way to establish what your path is,
check it against known paths, if it exists use a certain stylesheet. There
may be an easier way to do this than switches, but I have yet to find one.
Tony
-----Original Message-----
From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 11:11 AM
To: Php-Windows
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] How can I?
I'm not quite sure what you're asking for here, but let me take a shot:
Do you want the scripts in, say, your index.php's to know what folder
they're in and act accordingly?
So you'd essentially have exactly the same index.php in every folder,
but they would do different things depending on if they were in
/company/ or in /customer/ or in /tips/?
If so, you could get the SCRIPT_NAME from the server variables, then use
the dirname() function and some parsing to get the last directory name
in the path. But that seems to lead to the "too many SWITCH statements"
thing that you're trying to avoid.
Maybe if you could clarify what you're trying to do, it might help us
determine the best course of action.
-TG
> -----Original Message-----
> From: Tony Devlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 9:20 AM
>
> Onto the real question. I'm trying to make a switch
> statement that switches a header file based upon
> what folder you are in...
>
> An example:
>
> Let's say I have 3 folders with some files inside.
>
> /company/
> --> index.php
> --> contact.php
>
> /customer/
> --> index.php
> --> profile.php
>
> /tips/
> --> index.php
>
>
> Basically instead of building a huge switch with EVERY full
> path file name included, I want to just make a switch based
> on folder, then every file inside that folder will have
> the switch applied to it. I am sure this is
> possible, anyone have any ideas about how to do this?
>
> Greatly appreciated,
>
> Tony Devlin
>
--- End Message ---
--- Begin Message ---
I think you're over-thinking this one or maybe doing it the hard way.
If everything in a particular folder is always going to have the same
theme, then just put the stylesheet in that folder and references it in
the HTML you output.
"localstyle.css"
Something like that.
If you want to be able to have 'themes', then dynically alter the
filename vial PHP:
"$themename-localstyle.css"
You could do the same thing with getting the directory name and using
that like you'd use a $themename.
Anyway, that's what I'd do instead of worrying about switch statements
and all.
Would that work for what you're trying to do?
-TG
> -----Original Message-----
> From: Tony Devlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 11:20 AM
> To: Php-Windows
> Subject: RE: [PHP-WIN] How can I?
>
>
> The reasoning for this is so that I can apply different
> stylesheets and
> formatting to different pages inside a specific site. The
> entire site is
> dynamic and changeable, they can add pages/subtract pages,
> etc.. so the
> layout information needs to be controlled on the header page, the only
> static/untouchable page.
>
> Let's say everything in compayn folder is blue text, but I
> want everything
> in the customer folder to be green text. How do you control
> that when you
> have dynamic pages? .. easy you find a way to establish what
> your path is,
> check it against known paths, if it exists use a certain
> stylesheet. There
> may be an easier way to do this than switches, but I have yet
> to find one.
>
> Tony
>
>
> -----Original Message-----
> From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 11:11 AM
> To: Php-Windows
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] How can I?
>
>
> I'm not quite sure what you're asking for here, but let me
> take a shot:
>
> Do you want the scripts in, say, your index.php's to know what folder
> they're in and act accordingly?
>
> So you'd essentially have exactly the same index.php in every folder,
> but they would do different things depending on if they were in
> /company/ or in /customer/ or in /tips/?
>
> If so, you could get the SCRIPT_NAME from the server
> variables, then use
> the dirname() function and some parsing to get the last directory name
> in the path. But that seems to lead to the "too many SWITCH
> statements"
> thing that you're trying to avoid.
>
> Maybe if you could clarify what you're trying to do, it might help us
> determine the best course of action.
>
> -TG
>
> > -----Original Message-----
> > From: Tony Devlin [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 22, 2004 9:20 AM
> >
> > Onto the real question. I'm trying to make a switch
> > statement that switches a header file based upon
> > what folder you are in...
> >
> > An example:
> >
> > Let's say I have 3 folders with some files inside.
> >
> > /company/
> > --> index.php
> > --> contact.php
> >
> > /customer/
> > --> index.php
> > --> profile.php
> >
> > /tips/
> > --> index.php
> >
> >
> > Basically instead of building a huge switch with EVERY full
> > path file name included, I want to just make a switch based
> > on folder, then every file inside that folder will have
> > the switch applied to it. I am sure this is
> > possible, anyone have any ideas about how to do this?
> >
> > Greatly appreciated,
> >
> > Tony Devlin
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Well it's not "just" stylesheet changes. We have links that are different
for the different folders. For example we have a left navigation bar,
those links displayed there will change based on the directory, as well as a
couple H1 tags that display some basic info that differs directory
to directory. It's awhole lot easier to have all this in one file and then
switch the output based on the directory location, then it is to have
seperate files for each, not to mention in an dynamic page where everything
on that page is changeable, how do you add the proper link to
that stylesheet or function page? .. Sure you could fopen the page after
it's been created and then fwrite the link in, but you'd still need a
switch to know what link to fwrite in and opening sockets like that is just
an invite to trouble.
Atleast thats my opinion on the matter. Remember they can create pages on
the fly, and these people who create the pages are how do we
say, HTML challenged? I think thats the politically correct term.
Thanks,
Tony D.
-----Original Message-----
From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 11:48 AM
To: Php-Windows
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] How can I?
I think you're over-thinking this one or maybe doing it the hard way.
If everything in a particular folder is always going to have the same
theme, then just put the stylesheet in that folder and references it in
the HTML you output.
"localstyle.css"
Something like that.
If you want to be able to have 'themes', then dynically alter the
filename vial PHP:
"$themename-localstyle.css"
You could do the same thing with getting the directory name and using
that like you'd use a $themename.
Anyway, that's what I'd do instead of worrying about switch statements
and all.
Would that work for what you're trying to do?
-TG
> -----Original Message-----
> From: Tony Devlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 11:20 AM
> To: Php-Windows
> Subject: RE: [PHP-WIN] How can I?
>
>
> The reasoning for this is so that I can apply different
> stylesheets and
> formatting to different pages inside a specific site. The
> entire site is
> dynamic and changeable, they can add pages/subtract pages,
> etc.. so the
> layout information needs to be controlled on the header page, the only
> static/untouchable page.
>
> Let's say everything in compayn folder is blue text, but I
> want everything
> in the customer folder to be green text. How do you control
> that when you
> have dynamic pages? .. easy you find a way to establish what
> your path is,
> check it against known paths, if it exists use a certain
> stylesheet. There
> may be an easier way to do this than switches, but I have yet
> to find one.
>
> Tony
>
>
> -----Original Message-----
> From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 11:11 AM
> To: Php-Windows
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] How can I?
>
>
> I'm not quite sure what you're asking for here, but let me
> take a shot:
>
> Do you want the scripts in, say, your index.php's to know what folder
> they're in and act accordingly?
>
> So you'd essentially have exactly the same index.php in every folder,
> but they would do different things depending on if they were in
> /company/ or in /customer/ or in /tips/?
>
> If so, you could get the SCRIPT_NAME from the server
> variables, then use
> the dirname() function and some parsing to get the last directory name
> in the path. But that seems to lead to the "too many SWITCH
> statements"
> thing that you're trying to avoid.
>
> Maybe if you could clarify what you're trying to do, it might help us
> determine the best course of action.
>
> -TG
>
> > -----Original Message-----
> > From: Tony Devlin [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 22, 2004 9:20 AM
> >
> > Onto the real question. I'm trying to make a switch
> > statement that switches a header file based upon
> > what folder you are in...
> >
> > An example:
> >
> > Let's say I have 3 folders with some files inside.
> >
> > /company/
> > --> index.php
> > --> contact.php
> >
> > /customer/
> > --> index.php
> > --> profile.php
> >
> > /tips/
> > --> index.php
> >
> >
> > Basically instead of building a huge switch with EVERY full
> > path file name included, I want to just make a switch based
> > on folder, then every file inside that folder will have
> > the switch applied to it. I am sure this is
> > possible, anyone have any ideas about how to do this?
> >
> > Greatly appreciated,
> >
> > Tony Devlin
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
What's the lowest common factor in how changes are applied? If
everything created in "/company/" is going to have the same style, same
left hand navigation, etc... And everything in "/clients/" is going to
have the same style, same left hand navigation, etc... Then I'd
recommend something like this:
/company/
--> index.php
--> contact.php
--> stylesheet.css
--> navigation.php
/customer/
--> index.php
--> profile.php
--> stylesheet.css
--> navigation.php
/tips/
--> index.php
--> stylesheet.css
--> navigation.php
And have each index.php just point to "stylesheet.css" and
"navigation.php". I'm assuming your navigation is in a frame, but even
if it isn't, you can do an include() or something to pull the
navigation.php file into your main script.
Any changes made to navigation.php will affect all files within that
folder since they're all going to point to "navigation.php", a relative
reference to the local navigation.php file.
Same with stylesheet.css. Any changes made to the one in that folder
will apply to all files in that folder.
So when you dynamically create stuff via PHP (or even if they manually
create regular HTML files), just give them a template to use. Say
"start with this, don't change anything in it, just add content where it
says ti add content". Or if they create pages dynamically via PHP, then
take the data they enter and insert it into the PHP via your script.
Another option would be to store a config file either in your root
folder or in each sub-folder. If it was in INI style format, it might
be something like this:
[Company]
Style="/stylesheets/companystyle.css
"Nav=companynav.php
HeaderText="<h1>Company</h1>"
[Customers]
Style="/stylesheets/customerstyle.css"
Nav=customernav.php
HeaderText="<h1>Customers</h1>"
Or create your own custom config file:
[Company]
--Style
<style> .... Take everything after "--Style" and before the next "--"
tag and insert it as style information</style>
--Navigation
<table>
<tr>
<td>Some navigation links maybe in a table or something</td>
</tr>
</table>
--Header
<h1> Some company header text</h1>
Then you could have all the styles, headers, navigation information,
etc... All in one file and you just parse the data using PHP looking for
the [Tag] that matches the folder name.
I'd probably just put individual "stylesheet.css" and "navigation.php"
and "headerinclude.inc.php" files in the individual folders myself. If
I needed to be able to edit them all in one place, I'd write a PHP
configuration management script that got a list of all the folders in
the root folder, then looked for the config files in each folder.
If you make it dynamic, by just making all your scripts look for a
"navigation.php" in the current folder, then you can copy a whole
folder, make a couple of little changes, and it all works just fine.
If you have all your configuration stuff in one file, you can copy a
section, but what if you make a typo in the name. Or what if you forget
to put a closing "]" on a section heading, or mis-paste something. Then
it could affect all the other style sheets and navigation page
information for all the sections after the typo (depending on how you
parse the config file).
What happens if someone else is called in to work on your stuff.... Or
you leave your job and another programmer has to pick up where you left
off. If they don't notice that you have a config file somewhere and
they just move the folders, they may not figure out right away what's
wrong. I like the idea of a folder being as self contained as possible.
I only use root folder config files or things when it's something that's
reused for the entire site. Like I use an "/includes/" folder that
has some commonly used PHP scripts for date conversion, activity
logging, database abstraction stuff, etc. I also tend to use a
"/images/" folder for commonly used navigation images, logos, etc.
Anything specific to a certain section or folder, I put within that
folder.
I like to my make my scripts kind of dumb and modular.
Now going back to the question I asked at the beginning of this email.
How specific are these changes you're talking about? Are they specific
to the folder or will there be files within the folder that have
different stylesheets, navigation, headers, etc? It doesn't sound like
it. Sounds like each folder has it's own set of nav, style and header
that is used for all files/scripts within that folder.
I want to point out that this is becoming a question of style and
preference. This is how I'd do it, but it may not be the best way for
YOU to do it for YOUR style. Don't take my statements as "I'm right,
you're wrong" type stuff. Just trying to point out why I would do it
the way I'd do it. But there are a ton of ways to do what it sounds
like you need. I'm trying to present as many options as I can for you
to consider. But there's definitely a method that I think is 'best',
but that's my style and my opinion.
Get creative! PHP is so powerful and flexible that just about any
scheme you come up with can be made to work. If you decide later that
you want to do it a different way, then you can always go back and
update it.
We grow and learn by experimenting and failing and trying new things.
Don't be afraid to just pick a method and go with it. If you find out
later that you don't like it or that it doesn't work the way you need it
to, go back and try something else. :)
-TG
> -----Original Message-----
> From: Tony Devlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 12:16 PM
> To: Php-Windows
> Subject: RE: [PHP-WIN] How can I?
>
>
> Well it's not "just" stylesheet changes. We have links that
> are different
> for the different folders. For example we have a left navigation bar,
> those links displayed there will change based on the
> directory, as well as a
> couple H1 tags that display some basic info that differs directory
> to directory. It's awhole lot easier to have all this in
> one file and then
> switch the output based on the directory location, then it is to have
> seperate files for each, not to mention in an dynamic page
> where everything
> on that page is changeable, how do you add the proper link to
> that stylesheet or function page? .. Sure you could fopen the
> page after
> it's been created and then fwrite the link in, but you'd still need a
> switch to know what link to fwrite in and opening sockets
> like that is just
> an invite to trouble.
>
> Atleast thats my opinion on the matter. Remember they can
> create pages on
> the fly, and these people who create the pages are how do we
> say, HTML challenged? I think thats the politically correct term.
>
> Thanks,
>
> Tony D.
>
> -----Original Message-----
> From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 22, 2004 11:48 AM
> To: Php-Windows
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] How can I?
>
>
> I think you're over-thinking this one or maybe doing it the hard way.
>
> If everything in a particular folder is always going to have the same
> theme, then just put the stylesheet in that folder and
> references it in
> the HTML you output.
>
> "localstyle.css"
>
> Something like that.
>
> If you want to be able to have 'themes', then dynically alter the
> filename vial PHP:
>
>
> "$themename-localstyle.css"
>
>
> You could do the same thing with getting the directory name and using
> that like you'd use a $themename.
>
> Anyway, that's what I'd do instead of worrying about switch statements
> and all.
>
> Would that work for what you're trying to do?
>
> -TG
>
> > -----Original Message-----
> > From: Tony Devlin [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 22, 2004 11:20 AM
> > To: Php-Windows
> > Subject: RE: [PHP-WIN] How can I?
> >
> >
> > The reasoning for this is so that I can apply different
> > stylesheets and
> > formatting to different pages inside a specific site. The
> > entire site is
> > dynamic and changeable, they can add pages/subtract pages,
> > etc.. so the
> > layout information needs to be controlled on the header
> page, the only
> > static/untouchable page.
> >
> > Let's say everything in compayn folder is blue text, but I
> > want everything
> > in the customer folder to be green text. How do you control
> > that when you
> > have dynamic pages? .. easy you find a way to establish what
> > your path is,
> > check it against known paths, if it exists use a certain
> > stylesheet. There
> > may be an easier way to do this than switches, but I have yet
> > to find one.
> >
> > Tony
> >
> >
> > -----Original Message-----
> > From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 22, 2004 11:11 AM
> > To: Php-Windows
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] How can I?
> >
> >
> > I'm not quite sure what you're asking for here, but let me
> > take a shot:
> >
> > Do you want the scripts in, say, your index.php's to know
> what folder
> > they're in and act accordingly?
> >
> > So you'd essentially have exactly the same index.php in
> every folder,
> > but they would do different things depending on if they were in
> > /company/ or in /customer/ or in /tips/?
> >
> > If so, you could get the SCRIPT_NAME from the server
> > variables, then use
> > the dirname() function and some parsing to get the last
> directory name
> > in the path. But that seems to lead to the "too many SWITCH
> > statements"
> > thing that you're trying to avoid.
> >
> > Maybe if you could clarify what you're trying to do, it
> might help us
> > determine the best course of action.
> >
> > -TG
> >
> > > -----Original Message-----
> > > From: Tony Devlin [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, November 22, 2004 9:20 AM
> > >
> > > Onto the real question. I'm trying to make a switch
> > > statement that switches a header file based upon
> > > what folder you are in...
> > >
> > > An example:
> > >
> > > Let's say I have 3 folders with some files inside.
> > >
> > > /company/
> > > --> index.php
> > > --> contact.php
> > >
> > > /customer/
> > > --> index.php
> > > --> profile.php
> > >
> > > /tips/
> > > --> index.php
> > >
> > >
> > > Basically instead of building a huge switch with EVERY full
> > > path file name included, I want to just make a switch based
> > > on folder, then every file inside that folder will have
> > > the switch applied to it. I am sure this is
> > > possible, anyone have any ideas about how to do this?
> > >
> > > Greatly appreciated,
> > >
> > > Tony Devlin
--- End Message ---
--- Begin Message ---
I am reading a file into an array ($data_old = file("config.old");) and then
processing it as I receive information from the user. As we all know, the
Internet is stateless, so I need to read back in the array after I get my
answer.
Array definitions are
$data_old = array();
$data_new = array();
$data_count = 0;
The output code is
echo "<P><input type='hidden' name='data_old' value='".$data_old."'>";
echo "<P><input type='hidden' name='data_old' value='".$data_new."'>";
echo "<P><input type='hidden' name='data_count' value=".$data_count.">";
and the input code is
$data_old = $_REQUEST['data_old'];
$data_new = $_REQUEST['data_new'];
$data_count = $_REQUEST['data_count'];
$data_count is working so I am assuming my problem is the way that I am
passing the array. How can I pass an array or is it not possible? I would
think that anything can be passed as it is just bits of data (pun intended).
So what goes out should come in. But, for some reason, that is not
happening.
Any help, suggestions, and guidance is appreciated.
Mike
--- End Message ---
--- Begin Message ---
You can pass array data by adding it to the form (probably not a good
practice, I would choose sessions to pass the data, but incase you have some
need that is ok, try the following);
// To add the data to your form;
Foreach($data_old as $k => $v) echo "<input type=hidden
name=\"dataold[".$k."]\" value = \"".$v."\">\n";
// to get the data returned from the form add the following to the module
specified in the form action field
$data_old = $_POST["dataold"];
// $data_old now contains the array contents
Haven't tried this but I suspect it should work; anyone aware of a limit on
the number of hidden elements in a form?
Hope this helps,
Warren Vail
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> Sent: Monday, November 22, 2004 3:50 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Passing an Array in HTML
>
>
> I am reading a file into an array ($data_old =
> file("config.old");) and then processing it as I receive
> information from the user. As we all know, the Internet is
> stateless, so I need to read back in the array after I get my answer.
>
> Array definitions are
>
> $data_old = array();
> $data_new = array();
> $data_count = 0;
>
> The output code is
>
> echo "<P><input type='hidden' name='data_old'
> value='".$data_old."'>"; echo "<P><input type='hidden'
> name='data_old' value='".$data_new."'>"; echo "<P><input
> type='hidden' name='data_count' value=".$data_count.">";
>
> and the input code is
>
> $data_old = $_REQUEST['data_old'];
> $data_new = $_REQUEST['data_new'];
> $data_count = $_REQUEST['data_count'];
>
> $data_count is working so I am assuming my problem is the way
> that I am passing the array. How can I pass an array or is
> it not possible? I would think that anything can be passed
> as it is just bits of data (pun intended). So what goes out
> should come in. But, for some reason, that is not happening.
>
> Any help, suggestions, and guidance is appreciated.
>
> Mike
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
So the only way to do it is by separating all of the elements instead of
sending it as one big array? Hmmm. There is no better way to pass an
array?
Thanks.
Mike
"Vail, Warren" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You can pass array data by adding it to the form (probably not a good
> practice, I would choose sessions to pass the data, but incase you have
some
> need that is ok, try the following);
>
> // To add the data to your form;
>
> Foreach($data_old as $k => $v) echo "<input type=hidden
> name=\"dataold[".$k."]\" value = \"".$v."\">\n";
>
> // to get the data returned from the form add the following to the module
> specified in the form action field
>
> $data_old = $_POST["dataold"];
>
> // $data_old now contains the array contents
>
> Haven't tried this but I suspect it should work; anyone aware of a limit
on
> the number of hidden elements in a form?
>
> Hope this helps,
>
> Warren Vail
>
>
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > Sent: Monday, November 22, 2004 3:50 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Passing an Array in HTML
> >
> >
> > I am reading a file into an array ($data_old =
> > file("config.old");) and then processing it as I receive
> > information from the user. As we all know, the Internet is
> > stateless, so I need to read back in the array after I get my answer.
> >
> > Array definitions are
> >
> > $data_old = array();
> > $data_new = array();
> > $data_count = 0;
> >
> > The output code is
> >
> > echo "<P><input type='hidden' name='data_old'
> > value='".$data_old."'>"; echo "<P><input type='hidden'
> > name='data_old' value='".$data_new."'>"; echo "<P><input
> > type='hidden' name='data_count' value=".$data_count.">";
> >
> > and the input code is
> >
> > $data_old = $_REQUEST['data_old'];
> > $data_new = $_REQUEST['data_new'];
> > $data_count = $_REQUEST['data_count'];
> >
> > $data_count is working so I am assuming my problem is the way
> > that I am passing the array. How can I pass an array or is
> > it not possible? I would think that anything can be passed
> > as it is just bits of data (pun intended). So what goes out
> > should come in. But, for some reason, that is not happening.
> >
> > Any help, suggestions, and guidance is appreciated.
> >
> > Mike
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Only real array I've ever seen in HTML is one passed to JavaScript. Anyone
else found another way?
I suppose you could do it as a pull down list (preselecting all selections),
but risk is your user will screw up the data by clicking on the list, but
that struck me as kind of hokey (a technical term if the highest order ;-).
Warren Vail
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> Sent: Monday, November 22, 2004 4:08 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Re: Passing an Array in HTML
>
>
> So the only way to do it is by separating all of the elements
> instead of sending it as one big array? Hmmm. There is no
> better way to pass an array?
>
> Thanks.
>
> Mike
>
>
> "Vail, Warren" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> ab.com...
> > You can pass array data by adding it to the form (probably
> not a good
> > practice, I would choose sessions to pass the data, but incase you
> > have
> some
> > need that is ok, try the following);
> >
> > // To add the data to your form;
> >
> > Foreach($data_old as $k => $v) echo "<input type=hidden
> > name=\"dataold[".$k."]\" value = \"".$v."\">\n";
> >
> > // to get the data returned from the form add the following to the
> > module specified in the form action field
> >
> > $data_old = $_POST["dataold"];
> >
> > // $data_old now contains the array contents
> >
> > Haven't tried this but I suspect it should work; anyone aware of a
> > limit
> on
> > the number of hidden elements in a form?
> >
> > Hope this helps,
> >
> > Warren Vail
> >
> >
> > > -----Original Message-----
> > > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > > Sent: Monday, November 22, 2004 3:50 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] Passing an Array in HTML
> > >
> > >
> > > I am reading a file into an array ($data_old =
> > > file("config.old");) and then processing it as I receive
> information
> > > from the user. As we all know, the Internet is
> stateless, so I need
> > > to read back in the array after I get my answer.
> > >
> > > Array definitions are
> > >
> > > $data_old = array();
> > > $data_new = array();
> > > $data_count = 0;
> > >
> > > The output code is
> > >
> > > echo "<P><input type='hidden' name='data_old'
> > > value='".$data_old."'>"; echo "<P><input type='hidden'
> > > name='data_old' value='".$data_new."'>"; echo "<P><input
> > > type='hidden' name='data_count' value=".$data_count.">";
> > >
> > > and the input code is
> > >
> > > $data_old = $_REQUEST['data_old'];
> > > $data_new = $_REQUEST['data_new'];
> > > $data_count = $_REQUEST['data_count'];
> > >
> > > $data_count is working so I am assuming my problem is the
> way that I
> > > am passing the array. How can I pass an array or is it not
> > > possible? I would think that anything can be passed as
> it is just
> > > bits of data (pun intended). So what goes out should come
> in. But,
> > > for some reason, that is not happening.
> > >
> > > Any help, suggestions, and guidance is appreciated.
> > >
> > > Mike
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi,
Can anyone tell me what's wrong with the two following
programs? The first (whatsName.html) is straight
HTML, and is supposed to build a form that asks a
question. The second program, (hiUser.php) is
supposed to read the value input by the user, and
process it. I'm not having any trouble with the first
program, but when the second program runs, it prints
out code, rather than getting the result that it is
supposed to get.
Have I linked the two programs in the wrong way, or
something like that? BTW, both of these programs are
sample programs from the book, "PHP 5/MySQL
Programming for the Absolute Beginner."
Here are the two programs:
1.) whatsName.html:
<html>
<head>
<title>What's your name?</title>
</head>
<body>
<h1>What's your name?</h1>
<h3>Writing a form for user input</h3>
<form method = "post"
action = "hiUser.php">
Please type your name:
<input type = "text"
name = "userName"
value = "">
<br>
<input type = "submit">
</form>
</body>
</html>
Here is program #2.) hiUser.php:
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1>
<h3>PHP program that receives a value from
"whatsName"</h3>
<?
print "<h3>Hi there, $userName!</h3>";
?>
</body>
</html>
Your help is always appreciated!
Anthony
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com
--- End Message ---