[PHP] FREE CELL PHONE, FREE MEMBERSHIP, FREE SOFTWARE

2001-09-02 Thread Alice

YOUR FREE MEMBERSHIP!!

Plus get a Free Cell Phone and Free Computer Software  
To Help YOU Make MORE Money !! 

CHECK IT OUT! 
http://www.freewebco.net/bizopp  or
http://www.freewebhostingcentral.cc/bizopp

The Fastest Way To Earn $2000+ EVERY Month Online !!!

Looking for a secure and legitimate online home business?
One that WILL bring steady, dependable monthly checks 
EVERY month and in the shortest amount of time ?? 

We can share with you a way to earn $1000's per month 
on the Internet and receive GUARANTEED monthly checks 
that will continue to grow.

No Hype Here ! - We Can PROVE It !!

Free To Join - Means Instant Growth !
 
Can YOU give away FREE memberships? Most Certainly !! 
All day long in fact, AND earn an explosive income in 
doing so !

No pre-launch here!  Four year old company with 
proven system - that works !!
 
Making money on the Internet has never been EASIER ! 
 
Join Free and get your own free web site where you can 
watch your downline grow before your eyes !!  Check
it daily then you decide !!
 
See why thousands of people from all over the world are 
joining - FREE !
 
Lock in Your Position Today and we'll also give you 
promotional software that will increase traffic to ANY 
web site !!  See for Yourself !

Grab your ID Here !  DON"T MISS OUT !!

http://www.freewebco.net/bizopp  or
http://www.freewebhostingcentral.cc/bizopp
-



This is a one time mailing and you will not be contacted 
again and  though it is not necessary to request removal,
you may do so by  sending an email to:
mailto:[EMAIL PROTECTED]?subject=Please_Remove_Bizopp
 

-- 
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] How to Execute Multiple SQL Updates Using PHP

2008-11-19 Thread Alice Wei

Hi, 
 
  I am inquiring on this list to see if it is possible to create a script that 
takes multiple update statements without my having to write one "SQL" statement 
for each of the updates. 
 
  I have a scenario of which I create a table of some sort with some existing 
information using Flex, and what I am told by my client is that no matter how 
many records there are on the screen, the users should be able to update any up 
to all the entries by simply pushing a button. I use Microsoft SQL, which I 
think that it does allow multiple update query execution. The problem is that I 
might have to come up with some method to accept all the "POST" variables the 
user provides into the script. 
 
   Could anyone please give me some guidance on what kind of function I might 
use, or whether or not it is possible I can create a script that accepts as 
many "POST" variables as the users POST? 
 
Thanks a lot for your help.
 
Alice

_
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG

RE: [PHP] How to Execute Multiple SQL Updates Using PHP

2008-11-19 Thread Alice Wei

Hi, Todd:

  Each of my query snippets look something in the following format:

  UPDATE product
  
SET product_name = 'SQL Tool UltraLight' AND price='1000' AND sales='200' AND 
export='299' AND import='399' ...
  WHERE id = '1001'

   I don't think I am allowed to JOIN these queries in the first place 
according to some of the resources I have been reading. I only think I am 
allowed to execute the queries one by one. 

  But, in PHP terms, if I have a data executed from somewhere and allow users 
to edit it, how can I pass along every single one of these variables to the 
POST? (Is this what you meant by this is not something easy to do?)

Thanks in advance.

Alice


> Subject: RE: [PHP] How to Execute Multiple SQL Updates Using PHP
> Date: Wed, 19 Nov 2008 13:11:48 -0600
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]; php-general@lists.php.net
> 
> > -Original Message-
> > From: Alice Wei [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 19, 2008 12:51 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] How to Execute Multiple SQL Updates Using PHP
> > 
> >   I am inquiring on this list to see if it is possible to create a
> > script that takes multiple update statements without my having to
> write
> > one "SQL" statement for each of the updates.
> > 
> >   I have a scenario of which I create a table of some sort with some
> > existing information using Flex, and what I am told by my client is
> > that no matter how many records there are on the screen, the users
> > should be able to update any up to all the entries by simply pushing a
> > button. I use Microsoft SQL, which I think that it does allow multiple
> > update query execution. The problem is that I might have to come up
> > with some method to accept all the "POST" variables the user provides
> > into the script.
> > 
> >Could anyone please give me some guidance on what kind of function
> I
> > might use, or whether or not it is possible I can create a script that
> > accepts as many "POST" variables as the users POST?
> > 
> > Thanks a lot for your help.
> 
> ...sounds like more of a structure question than a PHP question, to be
> honest. So, structurally speaking, I would build your app to name the
> fields in a manner that is easily packaged and transported. That way,
> you can just do a for-each loop on the $_POST array and extract them
> using hints in your packaging method to tell which row and columns (and
> values) are being placed in the SQL query. You can name your fields
> something like "customerName[0]", "customerName[1]", etc., and PHP will
> treat them as an array when they are unpackaged from the $_POST
> parameters.
> 
> As for multiple SQL statements in one query, I don't see why creating a
> TRANSACTION block with multiple statements (separated by a semicolon:
> ';') wouldn't be possible in PHP. I've never tried it personally, but
> you are theoretically just passing your SQL server a query string--it
> handles the rest. (Yes, it's a bit more complex than that... but that's
> the brass tacks.)
> 
> HTH,
> 
> 
> // Todd

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

[PHP] PHP unlink Permission Error

2009-01-13 Thread Alice Wei

Hi, 
 
   I have a snippet of code as follows:
 
 
 
The problem is that I do not seem to have the correct permissions, even though 
I seem to have changed the permissions of the folder to 777 already upon the 
file deletion time. This is the output I got:
 
C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: 
Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 
9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in 
C:\Inetpub\wwwrootproject\file_write.php on line 10
 
Could anyone give me some tips on how to resolve this error? Thanks in advance.
 
Alice
_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

RE: [PHP] PHP unlink Permission Error

2009-01-13 Thread Alice Wei

Hi, Ashley:
 
  I thought about it and edited my script to check what permission I had, and 
it appears I do have the permission rights, and it actually changed to 0777. 
Here is the code:
 
 
The output:
 
0777Warning: unlink(testFile.txt) [function.unlink]: Permission denied in 
C:\Inetpub\wwwroot\project\file_write.php on line 10Warning: 
unlink(testFile.txt) [function.unlink]: Permission denied in 
C:\Inetpub\wwwroot\project\file_write.php n line 11If this is the case, how 
come I don't have the permissions to delete the file?
Thanks again.
 
Alice> Subject: Re: [PHP] PHP unlink Permission Error> From: 
a...@ashleysheridan.co.uk> To: aj...@alumni.iu.edu> CC: 
php-general@lists.php.net> Date: Tue, 13 Jan 2009 14:53:32 +> > On Tue, 
2009-01-13 at 09:42 -0500, Alice Wei wrote:> > Hi, > > > > I have a snippet of 
code as follows:> > > >  > > > ini_set('display_errors', 1); 
error_reporting(E_ALL);> > $curDir = getcwd();> > echo $curDir;> > 
chmod($curDir,0777);> > unlink("testFile.txt");> > echo unlink("testFile.txt"); 
> > chmod ($curDir,0755);> > ?> > > > > The problem is that I do not seem to 
have the correct permissions, even though I seem to have changed the 
permissions of the folder to 777 already upon the file deletion time. This is 
the output I got:> > > > C:\Inetpub\wwwroot\projectWarning: 
unlink(testFile.txt) [function.unlink]: Permission denied in 
C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: 
unlink(testFile.txt) [function.unlink]: Permission denied in 
C:\Inetpub\wwwrootproject\file_write.php on line 10> > > > Could anyone give me 
some tips on how to resolve this error? Thanks in advance.> > > > Alice> > 
_> > All-in-one 
security and maintenance for your PC. Get a free 90-day trial!> > 
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail> > You're 
using chmod to modify the permissions of the directory, but do> you actually 
have permissions to modify the permissions? If not, the> chmod will fail 
without giving an error, and then your unlink will fail> with an error.> > > 
Ash> www.ashleysheridan.co.uk> 
_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] PHP unlink Permission Error

2009-01-13 Thread Alice Wei

Hi, Ashley:
 
  I tried to find your corrected errors, but I cannot seem to find it. Have you 
sent me an empty reply message by mistake?
 
Alice> Subject: RE: [PHP] PHP unlink Permission Error> From: 
a...@ashleysheridan.co.uk> To: aj...@alumni.iu.edu> CC: 
php-general@lists.php.net> Date: Tue, 13 Jan 2009 15:09:44 +> > On Tue, 
2009-01-13 at 09:50 -0500, Alice Wei wrote:> > Hi, Ashley:> > > > I thought 
about it and edited my script to check what permission I> > had, and it appears 
I do have the permission rights, and it actually> > changed to 0777. Here is 
the code:> > > >  > > > ini_set('display_errors', 1); > > 
error_reporting(E_ALL);> > $curDir = getcwd();> > chmod($curDir,0777) or die 
("Failed to change permission");> > echo substr(sprintf('%o', 
fileperms($curDir)), -4); > > unlink("testFile.txt");> > echo 
unlink("testFile.txt"); > > > > ?> > > > > The output:> > > > 0777> > Warning: 
unlink(testFile.txt) [function.unlink]: Permission denied in> > 
C:\Inetpub\wwwroot\project\file_write.php on line 10> > > > Warning: 
unlink(testFile.txt) [function.unlink]: Permission denied in> > 
C:\Inetpub\wwwroot\project\file_write.php n line 11> > > > If this is the case, 
how come I don't have the permissions to delete> > the file?> > Thanks again.> 
> > > Alice> > > > > > > Subject: Re: [PHP] PHP unlink Permission Error> > > 
From: a...@ashleysheridan.co.uk> > > To: aj...@alumni.iu.edu> > > CC: 
php-general@lists.php.net> > > Date: Tue, 13 Jan 2009 14:53:32 +> > > > > > 
On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote:> > > > Hi, > > > > > > > > 
I have a snippet of code as follows:> > > > > > > >  > > > > > > > 
ini_set('display_errors', 1); error_reporting(E_ALL);> > > > $curDir = 
getcwd();> > > > echo $curDir;> > > > chmod($curDir,0777);> > > > 
unlink("testFile.txt");> > > > echo unlink("testFile.txt"); > > > > chmod 
($curDir,0755);> > > > ?> > > > > > > > > The problem is that I do not seem to 
have the correct permissions,> > even though I seem to have changed the 
permissions of the folder to> > 777 already upon the file deletion time. This 
is the output I got:> > > > > > > > C:\Inetpub\wwwroot\projectWarning: 
unlink(testFile.txt)> > [function.unlink]: Permission denied in 
C:\Inetpub\wwwroot\project> > \file_write.php on line 9Warning: 
unlink(testFile.txt)> > [function.unlink]: Permission denied in 
C:\Inetpub\wwwrootproject> > \file_write.php on line 10> > > > > > > > Could 
anyone give me some tips on how to resolve this error?> > Thanks in advance.> > 
> > > > > > Alice> > > > 
_> > > > 
All-in-one security and maintenance for your PC. Get a free 90-day> > trial!> > 
> > http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail> > > > > 
> You're using chmod to modify the permissions of the directory, but> > do> > > 
you actually have permissions to modify the permissions? If not, the> > > chmod 
will fail without giving an error, and then your unlink will> > fail> > > with 
an error.> > > > > > > > > Ash> > > www.ashleysheridan.co.uk> > > > > > > > > > 
> __> > 
Search from any Web page with powerful protection. Get the FREE> > Windows Live 
Toolbar Today! Try it now!> Hmm, is the current working directory the same as 
the one in which the> file is in? I know it seems like a silly question, but 
it's often the> silly ones that cause the most trouble!> > > Ash> 
www.ashleysheridan.co.uk> 
_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

[PHP] PHP unlink Errors

2009-01-13 Thread Alice Wei

Hi, 
 
  I have a snippet below that I would like to delete a file. However, I keep 
getting kicked out because of permission errors, when my folder permission is 
0777. 
 
 
 
Is it possible that someone on the list could point out what my possible errors 
are to allow this code to be functioning? 
 
Here is the output:
 
0777Warning: unlink(C:/Inetpub\wwwroot/project/testFile.txt) [function.unlink]: 
Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 
9Warning: unlink(C:/Inetpub/wwwroot/project/testFile.txt) [function.unlink]: 
Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10
 
Thanks in advance. 
 
Alice
_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

RE: [PHP] PHP unlink Errors

2009-01-13 Thread Alice Wei

Hi, 
 
Apparently my safe mode is off.  I tried fiddling with my code by changing the 
permission of my intended to delete file as in the following:
 
 
 
This is the output I get
07770666You don't have the permission 
 
I don't get a failure statement in the line: chmod ($fileToRemove, 0777) or die 
("permission canonot be set");, how come the permission of this file is still 
0666? 
 
Thanks in advance.
 
Alice
> Date: Tue, 13 Jan 2009 17:06:37 +0100> From: li...@bithub.net> To: 
> aj...@alumni.iu.edu> CC: php-general@lists.php.net> Subject: Re: [PHP] PHP 
> unlink Errors> > Do you have php_safe_mode enabled? If's that's the case, try 
> turning it > off and then run your script again.> Alice Wei wrote:> > Hi, > > 
> > > I have a snippet below that I would like to delete a file. However, I 
> keep getting kicked out because of permission errors, when my folder 
> permission is 0777. > > > >  > > > ini_set('display_errors', 1); 
> error_reporting(E_ALL);> > $curDir = getcwd();> > chmod($curDir,0777) or die 
> ("Failed to change permission");> > echo substr(sprintf('%o', 
> fileperms($curDir)), -4); > > 
> unlink("C:/Inetpub\wwwroot/project/testFile.txt");> > echo 
> unlink("C:/Inetpub/wwwroot/pproject/testFile.txt"); > > > > ?> > > > > Is it 
> possible that someone on the list could point out what my possible errors are 
> to allow this code to be functioning? > > > > Here is the output:> > > > 
> 0777Warning: unlink(C:/Inetpub\wwwroot/project/testFile.txt) 
> [function.unlink]: Permission denied in 
> C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: 
> unlink(C:/Inetpub/wwwroot/project/testFile.txt) [function.unlink]: Permission 
> denied in C:\Inetpub\wwwroot\project\file_write.php on line 10> > > > Thanks 
> in advance. > > > > Alice> > 
> _> > 
> All-in-one security and maintenance for your PC. Get a free 90-day trial!> > 
> http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail> > > --> 
> http://bithub.net/> Synchronize, share and backup your files over the web for 
> free> > http://twitter.com/MarcSteinert> My Twitter feed> **
_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] PHP unlink Permission Error

2009-01-13 Thread Alice Wei

Hi, Ashley:
 
  Sorry. To answer the question from your previous entry, it looks like that my 
permission could be set and changed for the folder, but when I do it on the 
"file", I only get 0666. I have the latest code on another entry. 
 
Thanks a lot for your help.
 
Alice





Alice Wei
Indiana University, Master of Information Science
Application Programmer ProCure Treatment Centers, Inc.420 N. Walnut 
St.Bloomington, IN 47404812-330-6644 (office)812-219-5708 
(mobile)alice@procurecenters.com(email)http://www.procurecenters.com/index.php
 (web) 

Subject: RE: [PHP] PHP unlink Permission ErrorFrom: 
a...@ashleysheridan.co.ukto: aj...@alumni.iu.educc: 
php-gene...@lists.php.netdate: Tue, 13 Jan 2009 16:36:36 +No, we 
tend to bottom-post on this list. It's just how we roll...



Ashwww.ashleysheridan.co.uk 
_
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG

RE: [PHP] PHP unlink Permission Error

2009-01-13 Thread Alice Wei





> Subject: RE: [PHP] PHP unlink Permission Error> From: 
> a...@ashleysheridan.co.uk> To: aj...@alumni.iu.edu> CC: 
> php-general@lists.php.net> Date: Tue, 13 Jan 2009 16:50:31 +> > On Tue, 
> 2009-01-13 at 11:33 -0500, Alice Wei wrote:> > Hi, Ashley:> > > > Sorry. To 
> answer the question from your previous entry, it looks> > like that my 
> permission could be set and changed for the folder, but> > when I do it on 
> the "file", I only get 0666. I have the latest code on> > another entry. > > 
> > > Thanks a lot for your help.> > > > Alice> > > > > > > > > > Alice Wei> > 
> > > Indiana University, Master of Information Science> > > > Application 
> Programmer > > ProCure Treatment Centers, Inc.> > 420 N. Walnut St.> > 
> Bloomington, IN 47404> > > > 812-330-6644 (office)> > 812-219-5708 (mobile)> 
> > > > alice@procurecenters.com(email)> > 
> http://www.procurecenters.com/index.php (web) > > > > > > > > > > > > > > 
> __> > 
> Subject: RE: [PHP] PHP unlink Permission Error> > From: 
> a...@ashleysheridan.co.uk> > To: aj...@alumni.iu.edu> > CC: 
> php-general@lists.php.net> > Date: Tue, 13 Jan 2009 16:36:36 +> > > > 
> > > > > No, we tend to bottom-post on this list. It's just how we 
> roll...> > > > > > Ash> > www.ashleysheridan.co.uk > > > > > > 
> __> > 
> Check the weather nationwide with MSN Search Try it now!> > The user that 
> your web server is running under (I'm guessing apache of> wwwrun) , does this 
> have permission to write to the file. If not, it> won't be able to set the 
> permissions for it. You may need to exec out a> sudo command to do it, but I 
> wouldn't recommend this.> > If you need PHP to be able to delete the file, 
> what put it there in the> first place?> > > Ash> www.ashleysheridan.co.uk> 
What I am trying to do here is that a user would be pushing a button so that 
the data entries would generate an outfile. The only issue is that the lines 
would be appended in the file, (I have no issues with this part writing to the 
file, no permission errors, etc). Therefore, before the outfile is generated, I 
need to have the prexisting outfile removed and recreated to be written to so 
that it always stays a new file for use. 
 
This is why this script as you have seen is as it is so that I can constantly 
check if the file exists, and generate a new file if there is. 
In this case, is there something I could do?
 
 
Thanks in advance.
 
Alice
 
 
_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

RE: [PHP] PHP unlink Permission Error

2009-01-14 Thread Alice Wei

> Subject: RE: [PHP] PHP unlink Permission Error> From: 
> a...@ashleysheridan.co.uk> To: aj...@alumni.iu.edu> CC: 
> php-general@lists.php.net> Date: Tue, 13 Jan 2009 17:07:34 +> > On Tue, 
> 2009-01-13 at 11:49 -0500, Alice Wei wrote:> > > > > > > > > Subject: RE: 
> [PHP] PHP unlink Permission Error> > > From: a...@ashleysheridan.co.uk> > > 
> To: aj...@alumni.iu.edu> > > CC: php-general@lists.php.net> > > Date: Tue, 13 
> Jan 2009 16:50:31 +> > > > > > On Tue, 2009-01-13 at 11:33 -0500, Alice 
> Wei wrote:> > > > Hi, Ashley:> > > > > > > > Sorry. To answer the question 
> from your previous entry, it looks> > > > like that my permission could be 
> set and changed for the folder,> > but> > > > when I do it on the "file", I 
> only get 0666. I have the latest> > code on> > > > another entry. > > > > > > 
> > > Thanks a lot for your help.> > > > > > > > Alice> > > > > > > > > > > > > 
> > > > > > > > Alice Wei> > > > > > > > Indiana University, Master of 
> Information Science> > > > > > > > Application Programmer > > > > ProCure 
> Treatment Centers, Inc.> > > > 420 N. Walnut St.> > > > Bloomington, IN 
> 47404> > > > > > > > 812-330-6644 (office)> > > > 812-219-5708 (mobile)> > > 
> > > > > > alice@procurecenters.com(email)> > > > 
> http://www.procurecenters.com/index.php (web) > > > > > > > > > > > > > > > > 
> > > > > > > > > > > > >> > 
> __> > > > 
> Subject: RE: [PHP] PHP unlink Permission Error> > > > From: 
> a...@ashleysheridan.co.uk> > > > To: aj...@alumni.iu.edu> > > > CC: 
> php-general@lists.php.net> > > > Date: Tue, 13 Jan 2009 16:36:36 +> > > > 
> > > > > > > > > > > > > No, we tend to bottom-post on this list. It's 
> just how we roll...> > > > > > > > > > > > Ash> > > > 
> www.ashleysheridan.co.uk > > > > > > > > > > > >> > 
> __> > > > 
> Check the weather nationwide with MSN Search Try it now!> > > > > > The user 
> that your web server is running under (I'm guessing apache> > of> > > wwwrun) 
> , does this have permission to write to the file. If not, it> > > won't be 
> able to set the permissions for it. You may need to exec> > out a> > > sudo 
> command to do it, but I wouldn't recommend this.> > > > > > If you need PHP 
> to be able to delete the file, what put it there in> > the> > > first place?> 
> > > > > > > > > Ash> > > www.ashleysheridan.co.uk> > > > > > > What I am 
> trying to do here is that a user would be pushing a button> > so that the 
> data entries would generate an outfile. The only issue is> > that the lines 
> would be appended in the file, (I have no issues with> > this part writing to 
> the file, no permission errors, etc). Therefore,> > before the outfile is 
> generated, I need to have the prexisting outfile> > removed and recreated to 
> be written to so that it always stays a new> > file for use. > > > > This is 
> why this script as you have seen is as it is so that I can> > constantly 
> check if the file exists, and generate a new file if there> > is. > > In this 
> case, is there something I could do?> > > > > > Thanks in advance.> > > > 
> Alice> > > > > > > > > > 
> __> > 
> All-in-one security and maintenance for your PC. Get a free 90-day> > trial! 
> Learn more!> > If your script is writing to the file, and the directory has 
> 777> permissions, then there should be no trouble deleting the file. If> 
> that's still a problem, why not each time the file needs to be created> anew, 
> open the file with a w flag, which will open it for writing, and> will try to 
> create the file if it doesn't already exist, so you wouldn't> ever need to 
> delete it at all.> > > Ash> www.ashleysheridan.co.uk> Hi, 
 
  It is weird, because what is on my code for appending and writing looks like 
this:
 
$myFile = "testFile.txt";
$fh = fopen($myFile, 'a');
fwrite($fh, $hello); 
fwrite($fh, "\r\n"); 
fclose($fh); 
 
The file itself gets executed continuously based on the number I have on the 
loop. 
And, my file for creating the file, I have shortened it to only 2 lines:
 
$handle = fopen("testFile.txt", "w");
fclose($handle);
 
What is interesting is that the files seem to be working, but the file keeps on 
getting appended rather than recreated when the my code to "w" the file get 
executed. I am using this with Actionscript, which calls the first function to 
open and write the file (or clean up the file), and then do whatever is needed 
in the second function to append the text to the file. 
 
Am I doing anything wrong here?
 
Thanks in advance.
_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

[PHP] Switch statement Question

2009-01-29 Thread Alice Wei

Hi, 
 
  I have a code snippet here as in the following:
 
//Switch statements between the four options 
switch($string) {
case "":
$string= "NOT book.author='All'";
break;
default:
$string= $string . "AND NOT book.author='All'";
break;
}
  This code does work, but I am wondering if it is possible in the switch 
statement clauses for me to do something like case does not equal to a certain 
author name if I don't want $string with that content to be processed. or, do I 
always use default in this case? 
 
Thanks in advance. 
 
Alice  
_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

[PHP] Spaces Not Detected from Regular Expression preg_match

2009-02-25 Thread Alice Wei

Hi, 

  I have a code as in the following:




This is the input file:

1
23kd
3dkd2
" "
4
5
6

For the output, I get nothing running it from the command prompt, but I would 
like to have " " in the output, 
could anyone please give me some guides on what I have done wrong in my regular 
expression?

Thanks for your help.

Alice






_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] Re: Spaces Not Detected from Regular Expression preg_match

2009-02-26 Thread Alice Wei

> To: php-general@lists.php.net
> Date: Wed, 25 Feb 2009 14:42:36 -0600
> From: nos...@mckenzies.net
> Subject: [PHP] Re: Spaces Not Detected from Regular Expression preg_match
> 
> Shawn McKenzie wrote:
> > Shawn McKenzie wrote:
> >> Alice Wei wrote:
> >>> Hi, 
> >>>
> >>>   I have a code as in the following:
> >>>
> >>>  >>>
> >>> $file = "test.txt";
> >>> $fp = fopen($file, "r");
> >>>
> >>>while(!feof($fp)) {
> >>>$data = fgets($fp, 1024);
> >>>
> >>>if ((preg_match("/0/",$data)) || 
> >>>   (preg_match("/\"\s\"/",$data)) || 
> >>>   (preg_match("/\"\s\"/",$data))) {
> >>>  //Don't do a thing
> >>>}
> >>>  
> >>> } 
> >>> fclose($fp);
> >>>
> >>> ?>
> >>>
> >>>
> >>> This is the input file:
> >>>
> >>> 1
> >>> 23kd
> >>> 3dkd2
> >>> " "
> >>> 4
> >>> 5
> >>> 6
> >>>
> >>> For the output, I get nothing running it from the command prompt, but I 
> >>> would like to have " " in the output, 
> >>> could anyone please give me some guides on what I have done wrong in my 
> >>> regular expression?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Alice
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> _
> >>> Search from any Web page with powerful protection. Get the FREE Windows 
> >>> Live Toolbar Today!
> >>> http://get.live.com/toolbar/overview
> >> Ummm...  #1 you haven't "output" anything in your code.  Your code says,
> >> if " " is found in $data, then "Don't do a thing".
> >>
> >>
> >>
> > 
> > So if your wanting to see if there is a match in the line and return the
> > match (which in this example seems pointless because you know that you
> > are matching ""), then something like this:
> > 
> > if (preg_match("/0/",$data, $matches) ||
> > preg_match("/\"\s\"/",$data, $matches))
> > {
> > print_r($matches);
> > }
> > 
> > BTW, the second and third conditions in your if appeared to be the same,
> > also \s matches whitespace, spaces, tabs, returns, etc...
> > 
> 
> I'll wait for a reply with more information as the more I look at your
> code it seems your off on a strange track.  I don't know the variability
> of your input data, but if you had a line 0 " " then the first
> preg_match would match the 0 and not the " ".  Maybe that's what you
> want, dunno...

Thanks, but I found that using line numbers of each and its remainder by a 
certain number works etter than using regular expressions here, since there is 
a lot of variability in the data from line to line.

Alice

> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

[PHP] Regular Expression Problem

2009-02-26 Thread Alice Wei

Hi, 

  I have two lines here as follows:

1  -0.123701962557954E+03   0.460967618024691E+02
-0.12354765900E+03   0.46259109000E+02

What I am trying to do here is to only have 

1  -0.123701962557954E+03   0.460967618024691E+02 be the output so I 
can do further processing with it, however, with the code I have in the 
following, I have both lines in the output. Here is the code:

$file = "test.txt";
$fp = fopen($file, "r");
$lines = file($file);

foreach($lines as $line_num => $line)
{
if (preg_match("/([^0-9]+\s+)(\-?\d+\.?\d+(\+?E?\d+)?){2}/", $line))

echo $line;

}
  
Could anyone please tell me that even when I specify that the line has to start 
with [^0-9]+\s with one occurrence, why I still get -0.12354765900E+03  
 0.46259109000E+02?

Thanks a lot for your help.

Alice


_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

RE: [PHP] Regular Expression Problem

2009-02-26 Thread Alice Wei

Hi, 
I have two lines here as follows:

1  -0.123701962557954E+03   0.460967618024691E+02
-0.12354765900E+03   0.46259109000E+02

What I am trying to do here is to only have 

1  -0.123701962557954E+03   0.460967618024691E+02 be the output so I 
can do further processing with it, however, with the code I have in the 
following, I have both lines in the output. Here is the code:

$file = "test.txt";
$fp = fopen($file, "r");
$lines = file($file);

foreach($lines as $line_num => $line)
{
if (preg_match("/([^0-9]+\s+)(\-?\d+\.?\d+(\+?E?\d+)?){2}/", $line))

echo $line;

}
  
Could anyone please tell me that even when I specify that the line has to start 
with [^0-9]+\s with one occurrence, why I still get -0.12354765900E+03  
 0.46259109000E+02?

Thanks a lot for your help.

Alice


_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us
  

[^0-9] means not a digital

^[0-9] is the right way..


Thanks for your help. I cannot imagine that I have missed that. 

Alice

_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

[PHP] How Much Data Can Be Written to a Database In One Instance?

2009-03-04 Thread Alice Wei

Hi, 

  I am working on a series of long files that contain 4 or 5 MB each, each of 
them is encoded in UTF-8 saved as .dat format. 
  However, I have noticed that when I do insert statements, the file only reads 
up to around 1MB and then would stop. If I split the file into 3 or 4 files, 
that would hold no more than 1.2 MB each, then I won't have problems. 

  Is there a limitation on how much data can be read and written in PHP within 
one instance? 

Thanks for your help.

Alice

_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] How Much Data Can Be Written to a Database In One Instance?

2009-03-04 Thread Alice Wei


> Subject: Re: [PHP] How Much Data Can Be Written to a Database In One  
> Instance?
> From: rob...@interjinn.com
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Date: Wed, 4 Mar 2009 15:26:38 -0500
> 
> On Wed, 2009-03-04 at 15:05 -0500, Alice Wei wrote:
> > Hi, 
> > 
> >   I am working on a series of long files that contain 4 or 5 MB each, each 
> > of them is encoded in UTF-8 saved as .dat format. 
> >   However, I have noticed that when I do insert statements, the file only 
> > reads up to around 1MB and then would stop. If I split the file into 3 or 4 
> > files, that would hold no more than 1.2 MB each, then I won't have 
> > problems. 
> > 
> >   Is there a limitation on how much data can be read and written in PHP 
> > within one instance? 
> 
> See this setting in your php.ini:
> 
> memory_limit = ???M
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 

Weird, I had 

memory_limit = 128M  ; Maximum amount of memory a script may consume (128MB)

However, the file that I was trying to read from was 5MB of text file. I tried 
to read it line by line and also ran one query for each line along the way 
before I got it to the database. If I have a file that is around 1MB, I have no 
problems, but once it passes that, a lot of lines go missing. 

Alice

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

RE: [PHP] How Much Data Can Be Written to a Database In One Instance?

2009-03-04 Thread Alice Wei


> Subject: Re: [PHP] How Much Data Can Be Written to a Database In One  
> Instance?
> From: rob...@interjinn.com
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Date: Wed, 4 Mar 2009 15:26:38 -0500
> 
> On Wed, 2009-03-04 at 15:05 -0500, Alice Wei wrote:
> > Hi, 
> > 
> >   I am working on a series of long files that contain 4 or 5 MB each, each 
> > of them is encoded in UTF-8 saved as .dat format. 
> >   However, I have noticed that when I do insert statements, the file only 
> > reads up to around 1MB and then would stop. If I split the file into 3 or 4 
> > files, that would hold no more than 1.2 MB each, then I won't have 
> > problems. 
> > 
> >   Is there a limitation on how much data can be read and written in PHP 
> > within one instance? 
> 
> See this setting in your php.ini:
> 
> memory_limit = ???M
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 

Weird, I had 

memory_limit = 128M  ; Maximum amount of memory a script may consume (128MB)

However, the file that I was trying to read from was 5MB of text file. I tried 
to read it line by line and also ran one query for each line along the way 
before I got it to the database. If I have a file that is around 1MB, I have no 
problems, but once it passes that, a lot of lines go missing. 

Alice

_
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG

RE: [PHP] How Much Data Can Be Written to a Database In One Instance?

2009-03-04 Thread Alice Wei


_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Line Break Problem

2009-03-09 Thread Alice Wei

Hi, 

  I have a question regarding using line breaks in PHP. I have the code 
something like:

   echo "1" . "\t " . $x . "\t" . $y . "\r\n";

When I run the code, it looks like a whole blob of text, but when I use "View 
Source", the line breaks are formatted then correctly. 
Anyone can please tell me if this is what this is supposed to be? 
If so, how can I get the user to see the line break as they are, do I have to 
use ?

Thanks for your help.

Alice







_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

RE: [PHP] Line Break Problem

2009-03-09 Thread Alice Wei



> Date: Mon, 9 Mar 2009 13:28:19 +0100
> From: joc...@iamjochem.com
> To: stut...@gmail.com
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: [PHP] Line Break Problem
> 
> Stuart schreef:
> > 2009/3/9 Alice Wei 
> > 
> >>  I have a question regarding using line breaks in PHP. I have the code
> >> something like:
> >>
> >>   echo "1" . "\t " . $x . "\t" . $y . "\r\n";
> >>
> >> When I run the code, it looks like a whole blob of text, but when I use
> >> "View Source", the line breaks are formatted then correctly.
> >> Anyone can please tell me if this is what this is supposed to be?
> >> If so, how can I get the user to see the line break as they are, do I have
> >> to use ?
> > 
> 
> you can also wrap the output in question in a  tag:
> 
> 
> 1 X   Y
> 2 X   Y
> 
> 
> alternatively use the nl2br() function ... but that won't help
> with displaying the tabs.
> 
> note that there is a difference between the output of your script
> (which you can view using 'View Source' when the output is sent to
> the browser) and the representation of that same source
> (by which I mean how the the source is rendered [in the browser, in this
> case).
> 
> HTML rendering ignores tabs, carriage returns and multiple consecutive spaces
> found in the source (with the exception of the  tag, possibly the  
> tag,
> additionally the CSS attribute 'whitespace', IIRC, can be used to force 
> rendering
> all whitespace chars.

Hi, all:



  Thanks to all who replied. It looks like that a simple  tag works great. 
  Looks like I didn't realize that \r\n does not reflect itself to the screen.

  

Alice


_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

RE: [PHP] How Much Data Can Be Written to a Database In One Instance?

2009-03-09 Thread Alice Wei




> Date: Wed, 4 Mar 2009 15:29:19 -0500
> Subject: Re: [PHP] How Much Data Can Be Written to a Database In One Instance?
> From: danbr...@php.net
> To: rob...@interjinn.com
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> 
> On Wed, Mar 4, 2009 at 15:26, Robert Cummings  wrote:
> >
> > See this setting in your php.ini:
> >
> > memory_limit = ???M
> 
> Also let us know what you're using for the database and how you're
> doing it.  You mention that the .dat files are 4-5MB, but don't say if
> that's the database you're using, or if you're reading from those and
> entering the data in MySQL, or what.
> 
> For example, if you're inserting data from there into MySQL, it's
> probably a MySQL issue that could be fixed by adjusting the packet
> size in your /etc/my.cnf (or equivalent) configuration file.
> 
> -- 
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

Hi, Daniel:

  I went back to my problem and looks like I could change the output_buffering 
and the query timeout time. 

Alice

_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

[PHP] Copy Non-Text file from One Server to Another Issues

2009-03-12 Thread Alice Wei

Hi, 

   I have a simple code as shown in the following:

http://remote_server/copy/play.txt";;
$file2 = "http://remote_server/copy/test.jpg";;
$file3 = "http://remote_server/copy/sample.pdf";;

//directory to copy to (must be CHMOD to 777)
$copydir = ".";

$data = file_get_contents($file);
$file2 = fopen($copydir . "/play.txt", "w+");
fputs($file2, $data);
fclose($file2);

$data2 = file_get_contents($file2);
$file3 = fopen($copydir . "/test.jpg", "w+");
fputs($file3, $data2);
fclose($file3);

$data3 = file_get_contents($file3);
$file4 = fopen($copydir . "/sample.pdf", "w+");
fputs($file4, $data3);
fclose($file4);

$data5= file_get_contents("play.txt");
echo $data5 . "";

$data6= file_get_contents("test.jpg");
echo $data6 . "";

$data7= file_get_contents("sample.pdf");
echo $data7 . "";

?> 

The first  one, $file, has no problems, and I did get the contents copied 
correctly. However, the second and third one, I get this error: 

Warning: file_get_contents() expects parameter 1 to be string, resource 
given in C:\Inetpub\wwwroot\test\hello.php on line 
18
./test.jpg 
Warning: file_get_contents() expects parameter 1 to be string, resource 
given in C:\Inetpub\wwwroot\test\hello.php on line 
25
./sample.pdf

I notice that the empty file gets created correctly, but I cannot put in the 
file contents. If file_get_contents only supports text, could anyone please 
give me some suggestions on what type of function I should use to put in the 
file contents so that it is readable?

Thanks in advance.

Alice
_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

RE: [PHP] Copy Non-Text file from One Server to Another Issues

2009-03-12 Thread Alice Wei



> Date: Thu, 12 Mar 2009 14:55:52 -0400
> Subject: Re: [PHP] Copy Non-Text file from One Server to Another Issues
> From: danbr...@php.net
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> On Thu, Mar 12, 2009 at 14:51, Alice Wei  wrote:
> >
> > Warning: file_get_contents() expects parameter 1 to be string, resource
> > given in C:\Inetpub\wwwroot\test\hello.php on line
> > 18
> 
> Freshman mistake.
> 
> $file2 = fopen($copydir . "/play.txt", "w+");
> 
> You're trying to read a data stream in file_get_contents() that
> was opened with fopen().  Don't.
> 
> Instead, replace the line of code above with:
> 
> $file2 = $copydir.'/play.txt';
> 
>  and then RTFM on how to use file_get_contents().
> 
> -- 
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

Hi, Daniel:
  
   Thanks, it turned out that other than using your suggestion, it turned out 
that using copy() works great. 
   However, is it possible for me not to use the actual physical url as I have 
provided in my code to access the information I intend to copy? 
   My goal is to be able to search through the remote directory, and find the 
matched files of a certain format and copy it to another server. 

Is this possible?

Alice

_
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG

[PHP] pdf_new() uncalled Function

2009-03-16 Thread Alice Wei

Hi, 

  I use Linux, and I had installed PHP using yum install php. I am trying to 
use the pdf_new function to create pdfs from existing text files, but I get 
this error 

PHP Fatal error:  Call to undefined function pdf_new() 

I have noticed that when I run the phpinfo() command, I cannot find the PDF 
phrase at all. My php.ini file does not even have these two lines 

  extension=php_pdf.dll
  extension=php_cpdf.dll

Could anyone suggest me what kind of command I should use if I need to build 
PDFs using PHP on a Linux system?

Thanks in advance. 

Alice



_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

RE: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Alice Wei

On Mon, Mar 16, 2009 at 10:06 AM, Alice Wei  wrote:



Hi,



  I use Linux, and I had installed PHP using yum install php. I am trying to 
use the pdf_new function to create pdfs from existing text files, but I get 
this error



PHP Fatal error:  Call to undefined function pdf_new()



I have noticed that when I run the phpinfo() command, I cannot find the PDF 
phrase at all. My php.ini file does not even have these two lines



  extension=php_pdf.dll

  extension=php_cpdf.dll



Could anyone suggest me what kind of command I should use if I need to build 
PDFs using PHP on a Linux system?



Thanks in advance.



Alice







_

Express yourself with gadgets on Windows Live Spaces

http://discoverspaces.live.com?source=hmtag1&loc=us
I like dompdf from www.digitaljunkies.ca Its a class that takes html and 
creates a pdf from it
I saw online at http://us3.php.net/manual/en/pdf.installation.php that I could 
build PDF from some extension. However, I use Linux, and I don't think this 
installation using dll extension supports it. I ran the code and still get this 
error. 

Any ideas?
Thanks for your help.

Alice
-- 

Bastien

Cat, the other other white meat

_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Alice Wei


Date: Mon, 16 Mar 2009 11:41:35 -0400
Subject: Re: [PHP] pdf_new() uncalled Function
From: phps...@gmail.com
To: aj...@alumni.iu.edu
CC: php-general@lists.php.net



On Mon, Mar 16, 2009 at 11:32 AM, Alice Wei  wrote:



On Mon, Mar 16, 2009 at 10:06 AM, Alice Wei  wrote:







Hi,







  I use Linux, and I had installed PHP using yum install php. I am trying to 
use the pdf_new function to create pdfs from existing text files, but I get 
this error







PHP Fatal error:  Call to undefined function pdf_new()







I have noticed that when I run the phpinfo() command, I cannot find the PDF 
phrase at all. My php.ini file does not even have these two lines







  extension=php_pdf.dll



  extension=php_cpdf.dll







Could anyone suggest me what kind of command I should use if I need to build 
PDFs using PHP on a Linux system?







Thanks in advance.







Alice















_



Express yourself with gadgets on Windows Live Spaces



http://discoverspaces.live.com?source=hmtag1&loc=us

I like dompdf from www.digitaljunkies.ca Its a class that takes html and 
creates a pdf from it

I saw online at http://us3.php.net/manual/en/pdf.installation.php that I could 
build PDF from some extension. However, I use Linux, and I don't think this 
installation using dll extension supports it. I ran the code and still get this 
error.




Any ideas?

Thanks for your help.



Alice

--



Bastien



Cat, the other other white meat



_

Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!

http://get.live.com/toolbar/overviewfor PECL based windows installation see 
http://us3.php.net/manual/en/install.pecl.downloads.php


another option is FPDF from www.fpdf.org another class

the classes are nice since they don't generally require the module to be 
installed. 

If you are on Linux, another option might be FOP... 
http://xmlgraphics.apache.org/fop/ 

  I checked out the first link you provided, and downloaded it. I don't
think I need to edit anything else from the file according to the
webpage http://www.digitaljunkies.ca/dompdf/install.php. I put the
entire extracted directory at my /var/www/html directory. Is there any
suggestion you could provide on how to "install" it? I don't see any commands 
that it provides in its manual. 



Thanks for your help.



Alice



_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

RE: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Alice Wei

[/snip]

another option is FPDF from www.fpdf.org another class



the classes are nice since they don't generally require the module to be 
installed.



If you are on Linux, another option might be FOP... 
http://xmlgraphics.apache.org/fop/



  I checked out the first link you provided, and downloaded it. I don't

think I need to edit anything else from the file according to the

webpage http://www.digitaljunkies.ca/dompdf/install.php. I put the

entire extracted directory at my /var/www/html directory. Is there any

suggestion you could provide on how to "install" it? I don't see any commands 
that it provides in its manual.



Thanks for your help.
Its a class set of files, so there is no real install. I just placed the folder 
containing the class files in my dir and in the calling page, required() the 
main file. 



The dompdf.inc.php file is where i handle the filesystem links
Looks like the files I wanted to turn into PDF are not web pages, but most of 
them are text files. I am still hoping to use the function pdf_new to get this 
to work by assembling some modules. Is what I am trying to do here not possible?

Thanks for your help.

Alice
-- 

Bastien

Cat, the other other white meat

_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

[PHP] String to Date Conversion Problem

2009-07-31 Thread Alice Wei

Hi, Guys:

  I am trying to turn a prepared line into a date format, and the string looks 
something like this: 23 JUL 09  -  THURSDAY, and I am trying to change the 
string to a mm/dd/ format that looks like 07/23/2009. 

  I tried to use strtotime() but it gave me nothing. 
  Here is the code: 

list($date,$month,$year,$dash,$day) = split(" ",$line,5);
echo "" . strtotime($date . "\s" . $month . "\s" . $year). 
"";

  Could anyone on the list please give me a hint on what I might have done 
wrong here? 

Thanks for your help.

Alice










_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

RE: [PHP] String to Date Conversion Problem

2009-07-31 Thread Alice Wei

Looks like what I did by using mm/dd/ was extra, which was probably why it 
didn't work. 
Thanks, looks like this is up and running now. 

Alice



> CC: php-general@lists.php.net
> From: stu...@stuconnolly.com
> To: aj...@alumni.iu.edu
> Subject: Re: [PHP] String to Date Conversion Problem
> Date: Fri, 31 Jul 2009 15:45:44 +0100
> 
> Hi Alice,
> 
> Based on the string format that you mentioned (DD MMM YY - DAY) you  
> should be able to transform to any other date using the following:
> 
> $parts = explode(' ', '23 JUL 09 - THURSDAY');
> 
> echo date('m/d/Y', strtotime("{$parts[1]} {$parts[0]} {$parts[2]}"));
> 
> Cheers
> 
> Stuart
> 
> On 31 Jul 2009, at 15:19, Alice Wei wrote:
> 
> >
> > Hi, Guys:
> >
> >  I am trying to turn a prepared line into a date format, and the  
> > string looks something like this: 23 JUL 09  -  THURSDAY, and I am  
> > trying to change the string to a mm/dd/ format that looks like  
> > 07/23/2009.
> >
> >  I tried to use strtotime() but it gave me nothing.
> >  Here is the code:
> >
> >list($date,$month,$year,$dash,$day) = split(" ",$line,5);
> >echo "" . strtotime($date . "\s" . $month . "\s" .  
> > $year). "";
> >
> >  Could anyone on the list please give me a hint on what I might have  
> > done wrong here?
> >
> > Thanks for your help.
> >
> > Alice
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _
> > All-in-one security and maintenance for your PC.  Get a free 90-day  
> > trial!
> > http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail
> 

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us

[PHP] Validating XML Issue

2009-09-03 Thread Alice Wei

Hi, 

  This seems like a small problem that I have read from 
http://us.php.net/manual/en/xmlreader.isvalid.php. 
  I have the code snippet here as follows:

setParserProperty(XMLReader::VALIDATE, true);

if ($xml->isValid()) echo "true";
else echo "NOT";

?>

Here is the contents of hello.xml:

 Hello

Obviously, this is not a well formed XML file. 

However, whenever I run the PHP code, it returns true, how do I get it to 
validate it the way it is supposed to be? 

Thanks for your help. 

Alice




_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

RE: [PHP] Validating XML Issue

2009-09-03 Thread Alice Wei

Hi, 



   Thanks for trying to help me out. I don't have a schema for my XML, but here 
is something cool I found that worked for me: 
http://www.w3schools.com/PHP/func_xml_error_string.asp

Alice

> Date: Thu, 3 Sep 2009 07:42:00 -0700
> From: matt...@thorslund.us
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: [PHP] Validating XML Issue
> 
> I'd say your XML document is not "well formed", but validity depends on 
> whether it conforms to the rules expressed in a schema.
> 
> Mattias
> 
> Alice Wei wrote:
> > Hi, 
> >
> >   This seems like a small problem that I have read from 
> > http://us.php.net/manual/en/xmlreader.isvalid.php. 
> >   I have the code snippet here as follows:
> >
> >  > $xml = XMLReader::open('hello.xml');
> >
> > // You must to use it
> > $xml->setParserProperty(XMLReader::VALIDATE, true);
> >
> > if ($xml->isValid()) echo "true";
> > else echo "NOT";
> >
> > ?>
> >
> > Here is the contents of hello.xml:
> >
> >  Hello
> >
> > Obviously, this is not a well formed XML file. 
> >
> > However, whenever I run the PHP code, it returns true, how do I get it to 
> > validate it the way it is supposed to be? 
> >
> > Thanks for your help. 
> >
> > Alice
> >
> >
> >
> >
> > _
> > Search from any Web page with powerful protection. Get the FREE Windows 
> > Live Toolbar Today!
> > http://get.live.com/toolbar/overview
> >   
> 
> 

_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

[PHP] SVG and PHP

2010-01-05 Thread Alice Wei

Hi, 

  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have: 



The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here? 

Thanks in advance. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/

RE: [PHP] SVG and PHP

2010-01-05 Thread Alice Wei



Hi,



  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have:







The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here?

Aren't you just opening the file? I think that you need to print it in some way 
suitable to your application.


Try using fread() or other function to read the contents of the file.
 
  Well, I tried, and here is the complete code of the portion I just edited:

#Load the Map
$ourFileName= "USA_Counties_with_FIPS_and_names.svg";
$fh = fopen($ourFileName, "r") or die("Can't open file");
$contents = fread($fh,filesize($ourFileName));
echo $contents;
fclose($fh); 
 
Now I get something on the screen, but still no image: image/svg+xml
Um, is there anything particular I need to put in my code? 


Thanks in advance.



Alice



_

Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

http://clk.atdmt.com/GBL/go/177141664/direct/01/
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/

RE: [PHP] SVG and PHP

2010-01-05 Thread Alice Wei







  
  


On Tue, 2010-01-05 at 15:15 -0500, Alice Wei wrote:



Hi,



  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have:







The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here?

Aren't you just opening the file? I think that you need to print it in some way 
suitable to your application.


Try using fread() or other function to read the contents of the file.
 
  Well, I tried, and here is the complete code of the portion I just edited:

#Load the Map
$ourFileName= "USA_Counties_with_FIPS_and_names.svg";
$fh = fopen($ourFileName, "r") or die("Can't open file");
$contents = fread($fh,filesize($ourFileName));
echo $contents;
fclose($fh); 
 
Now I get something on the screen, but still no image: image/svg+xml
Um, is there anything particular I need to put in my code? 


Thanks in advance.



Alice



_

Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

http://clk.atdmt.com/GBL/go/177141664/direct/01/
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/




View the source of your browser. Is it showing the SVG code? You need to output 
the correct mime-type headers for the SVG, as by default, PHP outputs headers 
for HTML. Something like this should do the trick:



header("Content-type: image/svg+xml");



This has to occur before any output has already been sent to the browser, 
otherwise you'll get a headers already sent error.


Thanks, this time it does the trick. 





Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/171222984/direct/01/

[PHP] SVG Won't Color?

2010-01-06 Thread Alice Wei

Hi, 
  
  I have the code as in the following, and I am trying to colorize the map. The 
SVG File is located here: 
http://upload.wikimedia.org/wikipedia/commons/5/5f/USA_Counties_with_FIPS_and_names.svg.
 Looks like when I tried to modify the contents of the line, it does not seem 
to take into affect. Thus, my map does not get colorized. Do I have to save the 
file here? Or, is there something else I have missed here? 

 10):
   $color = 5;
   break;   

   case ($array[$i] > 8):
   $color = 4;
   break;   
 
   case ($array[$i] > 6):
   $color = 3;
   break;   

   case ($array[$i] > 4):
   $color = 2;
   break;   

   case ($array[$i] > 2):
   $color = 1;
   break;   

   default:
   $color= 0;
   break; 

  }
  $color_class= $colors_array[$color];
  array_push($array4,$color_class);
}
   
foreach ($lines2 as $line_num => $line2) {

  $line_add_one = $line_num + 1;
  if(preg_match("/

Thanks for your help.

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390706/direct/01/

[PHP] Count the Number of Certain Elements in An Array

2010-01-11 Thread Alice Wei

Hi, 

  This seems like a pretty simple problem, but I can't seem to be able to 
figure it out. I have a lot of elements in an array, and some of them are 
duplicates, but I don't want to delete them because I have other purposes for 
it. Is it possible for me to find out the number of certain elements in an 
array? 

  For example, 

   // Create a simple array.
   $array = array(1, 2, 3, 4, 5, 3,3,4,2);
   $total = count($array);
   echo $total;
  
  If I run the code, the value of $total would be 9. However, what I really 
want to do is to get the values of the different instances of each, like:

   1 => 1
   2 => 2
   3 => 3
   4=>  2
   5=>  1

Is there a simple code that I use to find this out? 

Thanks for your help. 

Alice
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390707/direct/01/

RE: [PHP] Count the Number of Certain Elements in An Array

2010-01-11 Thread Alice Wei

> Date: Mon, 11 Jan 2010 18:31:43 -0300
> Subject: Re: [PHP] Count the Number of Certain Elements in An Array
> From: tapi...@gmail.com
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> On Mon, Jan 11, 2010 at 6:21 PM, Alice Wei  wrote:
> >
> > Hi,
> >
> >  This seems like a pretty simple problem, but I can't seem to be able to 
> > figure it out. I have a lot of elements in an array, and some of them are 
> > duplicates, but I don't want to delete them because I have other purposes 
> > for it. Is it possible for me to find out the number of certain elements in 
> > an array?
> >
> >  For example,
> >
> >   // Create a simple array.
> >   $array = array(1, 2, 3, 4, 5, 3,3,4,2);
> >   $total = count($array);
> >   echo $total;
> >
> >  If I run the code, the value of $total would be 9. However, what I really 
> > want to do is to get the values of the different instances of each, like:
> >
> >   1 => 1
> >   2 => 2
> >   3 => 3
> >   4=>  2
> >   5=>  1
> >
> > Is there a simple code that I use to find this out?
> >
> > Thanks for your help.
> >
> > Alice
> >
> > _
> > Hotmail: Trusted email with powerful SPAM protection.
> > http://clk.atdmt.com/GBL/go/196390707/direct/01/
> 
> 
> Hi,
> 
> Try the function array_count_values.
> 
   Thanks, this is cool. There is already a function for it!

> Regards,
> 
> Jonathan
  
_
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/196390708/direct/01/

[PHP] array_count_values Problem

2010-01-12 Thread Alice Wei

Hi, 

  I have a code in the following, after investigating more closely on how to 
use array_count_values():

  //Calculate the number of elements in array
$total_num = count($friend_from);
$total_num2 = count(array_unique($friend_from));
for ($i=0;$i<=$total_num2;$i++) echo $friend_from[$i] . " " . 
array_count_values($friend_from[$i]) . "\n";

  Neither of these two numbers, $total_num and $total_num2 are 0, but I only 
get something like this:

Monroe, IN 
Cherokee, OK 
Cherokee, OK 
Cleveland, OK 
Greer, OK 
  How come that I cannot get it to print out the individual array_count_values? 
Have I missed something here?
  Thanks for your help. 

  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390707/direct/01/

RE: [PHP] array_count_values Problem

2010-01-12 Thread Alice Wei

Hi, 

  Thanks for the replies. 

  Turns out that I can assign a variable $array_count = 
array_count_values($friend_from), and I accessed the individual values by doing 

for ($i=0;$i<$total_num;$i++) {

$friend_location = $friend_from[$i];  
$count_friend = $array_count[$friend_location];  
echo $count_friend . "\n";
}

Thanks again. 

Alice

> Date: Tue, 12 Jan 2010 13:17:57 -0300
> Subject: Re: [PHP] array_count_values Problem
> From: tapi...@gmail.com
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> Hi,
> 
> The function array_count_values returns an array
> (http://php.net/array_count_values). So you are using it the wrong
> way, you should assign the return value to a variable and then access
> some index.
> 
> Regards,
> 
> Jonathan
> 
> On Tue, Jan 12, 2010 at 11:09 AM, Alice Wei  wrote:
> >
> > Hi,
> >
> >  I have a code in the following, after investigating more closely on how to 
> > use array_count_values():
> >
> >  //Calculate the number of elements in array
> > $total_num = count($friend_from);
> > $total_num2 = count(array_unique($friend_from));
> > for ($i=0;$i<=$total_num2;$i++) echo $friend_from[$i] . " " . 
> > array_count_values($friend_from[$i]) . "\n";
> >
> >  Neither of these two numbers, $total_num and $total_num2 are 0, but I only 
> > get something like this:
> >
> > Monroe, IN
> > Cherokee, OK
> > Cherokee, OK
> > Cleveland, OK
> > Greer, OK
> >  How come that I cannot get it to print out the individual 
> > array_count_values? Have I missed something here?
> >  Thanks for your help.
> >
> >
> > _
> > Hotmail: Trusted email with powerful SPAM protection.
> > http://clk.atdmt.com/GBL/go/196390707/direct/01/
  
_
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/196390710/direct/01/

[PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei

Hi, 

  I forgot to mention that the url is formed from Actionscript, I am just using 
PHP to do the "I/O" because Actionscript does not have this option. 

  So, I guess I cannot do the serialize here like you suggested. I have changed 
# to 0x for now, and that does not seem to help yet. 
  BTW, below is the complete code, would this help with my choices?

 $line2) { 

$style_line_num = $line_num+3;
$line2 = trim($line2);

  if(preg_match("/^style/",$line2)) {

   $rest = substr($line2,0,-1);  

   for ($j=$line_num;$j<=$style_line_num;$j++){
 if(preg_match("/inkscape:label/",$lines2[$j])) {  
$location = explode("=",$lines2[$j]);
$location2 = substr($location[1],1,-6);  
   
if(in_array($patient_location2, $patient_from)) {
   
 $key= array_search($location2,$from); //Find out the position of 
the index in the array
 $colors_style = ";fill:" . $state_colors[$key];  //Use the index 
from array_search to apply to the color index
 $rest2 = substr($line2,0,-1). $colors_style . "\"";
 echo $rest2 . "\n";
}
else echo $line2 . "\n"; 

 } //end preg_match inkscape
 } //end for loop
   }  //If preg_match style

 else echo $line2 . "\n"; //else if preg_match style 
 } //end for each

fclose($fh);
?>

Thanks for your help. 

Alice

> Date: Thu, 25 Feb 2010 13:03:57 -0600
> From: nos...@mckenzies.net
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: PHP "GET" Error?
> 
> Shawn McKenzie wrote:
> > Alice Wei wrote:
> >> Hi, 
> >>
> >> I have done something wrong here, because when I have my variables 
> >> declared in my PHP:
> >>
> >>$people_from = $_GET['people_from'];
> >>$state_colors= $_GET['state_colors'];
> >>
> >>   I get this url: http://localhost/generic.php?people_from=Adair, 
> >> OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, OK-Bryan, 
> >> OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, OK-Choctaw, OK-Cimarron, 
> >> OK-Cleveland, OK-Coal, 
> >> OK&state_colors=#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF
> >>
> >>  The result? I don't get any colors on the screen as I have here in the 
> >> url. 
> >> However, if I do:
> >>
> >> $people_from = "Adair, OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, 
> >> OK-Blaine, OK-Bryan, OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, 
> >> OK-Choctaw, OK-Cimarron, OK-Cleveland, OK-Coal, OK";
> >> $state_colors= 
> >> "#CC-#CC-#FF-#FF-#FFCCCC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF";
> >>
> >> I get the correct result. In total, there are 77 entries (I only put 15 
> >> here). Is there a length limit for what I pass to the url? If not, how 
> >> come there are no colors showing up in my image as I desired according to 
> >> my url?
> >>
> >> Thanks for your help.
> >>
> >> Alice
> >>  
> >> _
> >> Hotmail: Free, trusted and rich email service.
> >> http://clk.atdmt.com/GBL/go/201469228/direct/01/
> > 
> > There are characters in the URL that have a meaning within a URL itself
> > (such as #).  Use urlencode() before putting the data in the URL.
> > 
> 
> FWIW, how I would probably handle this is to have an array of
> $people_from and an array of $state_colors and then serialize() them and
> run through urlencode().  Then you have an array on the next page.  Much
> easier to work with:
> 
> $people_from = array('K-Alfalfa', 'OK-Atoka'); //etc...
> $state_colors = array('#CC', '#CC'); //etc...
> 
> Then the link would be:
> 
> $url =
> 'generic.php?people_from='.urlencode(serialize($people_from)).'&state_colors'.urlencode(serialize($state_colors));
> 
> You then have a $_GET['people_from'] and $_GET['state_colors'] array on
> the next page.
> 
> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  
_
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/

[PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei


> Date: Thu, 25 Feb 2010 13:03:57 -0600
> From: nos...@mckenzies.net
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: PHP "GET" Error?
> 
> Shawn McKenzie wrote:
> > Alice Wei wrote:
> >> Hi, 
> >>
> >> I have done something wrong here, because when I have my variables 
> >> declared in my PHP:
> >>
> >>$people_from = $_GET['people_from'];
> >>$state_colors= $_GET['state_colors'];
> >>
> >>   I get this url: http://localhost/generic.php?people_from=Adair, 
> >> OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, OK-Bryan, 
> >> OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, OK-Choctaw, OK-Cimarron, 
> >> OK-Cleveland, OK-Coal, 
> >> OK&state_colors=#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF
> >>
> >>  The result? I don't get any colors on the screen as I have here in the 
> >> url. 
> >> However, if I do:
> >>
> >> $people_from = "Adair, OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, 
> >> OK-Blaine, OK-Bryan, OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, 
> >> OK-Choctaw, OK-Cimarron, OK-Cleveland, OK-Coal, OK";
> >> $state_colors= 
> >> "#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF";
> >>
> >> I get the correct result. In total, there are 77 entries (I only put 15 
> >> here). Is there a length limit for what I pass to the url? If not, how 
> >> come there are no colors showing up in my image as I desired according to 
> >> my url?
> >>
> >> Thanks for your help.
> >>
> >> Alice
> >>  
> >> _
> >> Hotmail: Free, trusted and rich email service.
> >> http://clk.atdmt.com/GBL/go/201469228/direct/01/
> > 
> > There are characters in the URL that have a meaning within a URL itself
> > (such as #).  Use urlencode() before putting the data in the URL.
> > 
> 
> FWIW, how I would probably handle this is to have an array of
> $people_from and an array of $state_colors and then serialize() them and
> run through urlencode().  Then you have an array on the next page.  Much
> easier to work with:
> 
> $people_from = array('K-Alfalfa', 'OK-Atoka'); //etc...
> $state_colors = array('#FFFFCC', '#CC'); //etc...
> 
> Then the link would be:
> 
> $url =
> 'generic.php?people_from='.urlencode(serialize($people_from)).'&state_colors'.urlencode(serialize($state_colors));
> 
> You then have a $_GET['people_from'] and $_GET['state_colors'] array on
> the next page.

  On another note, would this be different if I used POST instead of GET? 
(considering there are some limitation on the length of my url) I tried to look 
into that, but I don't see anything. 

Alice

> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  
_
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/

[PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei


> Date: Thu, 25 Feb 2010 13:50:16 -0600
> From: nos...@mckenzies.net
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: PHP "GET" Error?
> 
> Alice Wei wrote:
> > Hi, 
> > 
> >   I forgot to mention that the url is formed from Actionscript, I am just 
> > using PHP to do the "I/O" because Actionscript does not have this option. 
> > 
> >   So, I guess I cannot do the serialize here like you suggested. I have 
> > changed # to 0x for now, and that does not seem to help yet. 
> >   BTW, below is the complete code, would this help with my choices?
> > 
> 
> I haven't used actionscript, but it's javascript basically yes?
> 
> Use encodeURI() or encodeURIComponent() on the data.
> 
> 
   Yes, and no. But, I did find the function in the Actionscript library, and I 
used the new url to pass through to PHP. Looks like it still didn't work, could 
the length be an issue? 

   BTW, these two variables start off from Actionscript as "arrays", but would 
knowing this here help? It would be nice that I can just pass them on as arrays 
(I had to "turn them into strings" before I passed to PHP). 

Thanks for your help. 

Alice

> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  
_
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/201469229/direct/01/

[PHP] PHP "GET" Error?

2010-02-25 Thread Alice Wei

Hi, 

I have done something wrong here, because when I have my variables declared 
in my PHP:

   $people_from = $_GET['people_from'];
   $state_colors= $_GET['state_colors'];

  I get this url: http://localhost/generic.php?people_from=Adair, OK-Alfalfa, 
OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, OK-Bryan, OK-Caddo, OK-Canadian, 
OK-Carter, OK-Cherokee, OK-Choctaw, OK-Cimarron, OK-Cleveland, OK-Coal, 
OK&state_colors=#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF

 The result? I don't get any colors on the screen as I have here in the url. 
However, if I do:
   
$people_from = "Adair, OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, 
OK-Bryan, OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, OK-Choctaw, 
OK-Cimarron, OK-Cleveland, OK-Coal, OK";
$state_colors= 
"#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF";

I get the correct result. In total, there are 77 entries (I only put 15 here). 
Is there a length limit for what I pass to the url? If not, how come there are 
no colors showing up in my image as I desired according to my url?

Thanks for your help.

Alice
  
_
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/201469228/direct/01/

RE: [PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei

Subject: Re: [PHP] RE: PHP "GET" Error?
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: nos...@mckenzies.net; php-general@lists.php.net
Date: Thu, 25 Feb 2010 20:03:28 +






  
  


On Thu, 2010-02-25 at 15:01 -0500, Alice Wei wrote:


> Date: Thu, 25 Feb 2010 13:50:16 -0600
> From: nos...@mckenzies.net
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: PHP "GET" Error?
> 
> Alice Wei wrote:
> > Hi, 
> > 
> >   I forgot to mention that the url is formed from Actionscript, I am just 
> > using PHP to do the "I/O" because Actionscript does not have this option. 
> > 
> >   So, I guess I cannot do the serialize here like you suggested. I have 
> > changed # to 0x for now, and that does not seem to help yet. 
> >   BTW, below is the complete code, would this help with my choices?
> > 
> 
> I haven't used actionscript, but it's javascript basically yes?
> 
> Use encodeURI() or encodeURIComponent() on the data.
> 
> 
   Yes, and no. But, I did find the function in the Actionscript library, and I 
used the new url to pass through to PHP. Looks like it still didn't work, could 
the length be an issue? 

   BTW, these two variables start off from Actionscript as "arrays", but would 
knowing this here help? It would be nice that I can just pass them on as arrays 
(I had to "turn them into strings" before I passed to PHP). 

Thanks for your help. 

Alice

> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  
_
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/201469229/direct/01/




Have you tried outputting the URL string to see if it's properly formed? AS3 
can still trace() can't it?



This link should give you an idea of the string limits of different browsers 
and servers:



http://www.boutell.com/newfaq/misc/urllength.html

I have just done that, and here is the pathetically long url:

http://tdc-queuing/test/generic.php?from=Adair,%20OK-Alfalfa,%20OK-Atoka,%20OK-Beaver,%20OK-Beckham,%20OK-Blaine,%20OK-Bryan,%20OK-Caddo,%20OK-Canadian,%20OK-Carter,%20OK-Cherokee,%20OK-Choctaw,%20OK-Cimarron,%20OK-Cleveland,%20OK-Coal,%20OK-Comanche,%20OK-Cotton,%20OK-Craig,%20OK-Creek,%20OK-Custer,%20OK-Delaware,%20OK-Dewey,%20OK-Ellis,%20OK-Garfield,%20OK-Garvin,%20OK-Grady,%20OK-Grant,%20OK-Greer,%20OK-Harmon,%20OK-Harper,%20OK-Haskell,%20OK-Hughes,%20OK-Jackson,%20OK-Jefferson,%20OK-Johnston,%20OK-Kay,%20OK-Kingfisher,%20OK-Kiowa,%20OK-Latimer,%20OK-Le%20Flore,%20OK-Lincoln,%20OK-Logan,%20OK-Love,%20OK-Major,%20OK-Marshall,%20OK-Mayes,%20OK-McClain,%20OK-McCurtain,%20OK-McIntosh,%20OK-Murray,%20OK-Muskogee,%20OK-Noble,%20OK-Nowata,%20OK-Okfuskee,%20OK-Oklahoma,%20OK-Okmulgee,%20OK-Osage,%20OK-Ottawa,%20OK-Pawnee,%20OK-Payne,%20OK-Pittsburg,%20OK-Pontotoc,%20OK-Pottawatomie,%20OK-Pushmataha,%20OK-Roger%20Mills,%20OK-Rogers,%20OK-Seminole,%20OK-Sequoyah,%20OK-Stephens,%20OK-Texas,%20OK-Tillman,%20OK-Tulsa,%20OK-Wagoner,%20OK-Washington,%20OK-Washita,%20OK-Woods,%20OK-Woodward,%20OK&state_colors=0xCC-0xCC-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF

This is generated from the encodeURI() Shawn was talking about. Does this seem 
"well-formed" to you?

Thanks.

Alice




  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469227/direct/01/

[PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei

> 
> Alice Wei wrote:
> > 
> >> Date: Thu, 25 Feb 2010 13:50:16 -0600
> >> From: nos...@mckenzies.net
> >> To: aj...@alumni.iu.edu
> >> CC: php-general@lists.php.net
> >> Subject: Re: PHP "GET" Error?
> >>
> >> Alice Wei wrote:
> >>> Hi, 
> >>>
> >>>   I forgot to mention that the url is formed from Actionscript, I am just 
> >>> using PHP to do the "I/O" because Actionscript does not have this option. 
> >>>
> >>>   So, I guess I cannot do the serialize here like you suggested. I have 
> >>> changed # to 0x for now, and that does not seem to help yet. 
> >>>   BTW, below is the complete code, would this help with my choices?
> >>>
> >> I haven't used actionscript, but it's javascript basically yes?
> >>
> >> Use encodeURI() or encodeURIComponent() on the data.
> >>
> >>
> >Yes, and no. But, I did find the function in the Actionscript library, 
> > and I used the new url to pass through to PHP. Looks like it still didn't 
> > work, could the length be an issue? 
> > 
> >BTW, these two variables start off from Actionscript as "arrays", but 
> > would knowing this here help? It would be nice that I can just pass them on 
> > as arrays (I had to "turn them into strings" before I passed to PHP). 
> > 
> > Thanks for your help. 
> 
> Those functions will work if you do it properly.  As for arrays, the
> only way I know of in js is to json encode them and then you can use the
> PHP json_decode() to get them back.  There is no native js function to
> do this, however there may be one in the actionscript library or there
> are some functions on the web that people have written.
> 
> Wait, I found this:  http://code.google.com/p/as3corelib/
> 
> Functionality may already be in As, but may be of use.
> 
> 
When you meant function, do you mean the function from my PHP end to turn it 
into array, or Actionscript? 
Based on the url I sent Ashley, do you think that is something that would work? 

Thanks. 
> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469227/direct/01/

RE: [PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei

> Alice Wei wrote:
> > Hi, 
> > 
> >   I forgot to mention that the url is formed from Actionscript, I am just 
> > using PHP to do the "I/O" because Actionscript does not have this option. 
> > 
> >   So, I guess I cannot do the serialize here like you suggested. I have 
> > changed # to 0x for now, and that does not seem to help yet. 
> >   BTW, below is the complete code, would this help with my choices?
> > 
> 
> I haven't used actionscript, but it's javascript basically yes?
> 
> Use encodeURI() or encodeURIComponent() on the data.
> 
> 
   Yes, and no. But, I did find the function in the Actionscript library, and I 
used the new url to pass through to PHP. Looks like it still didn't work, could 
the length be an issue? 

   BTW, these two variables start off from Actionscript as "arrays", but would 
knowing this here help? It would be nice that I can just pass them on as arrays 
(I had to "turn them into strings" before I passed to PHP). 

Thanks for your help. 

Alice

> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
  


Have you tried outputting the URL string to see if it's properly formed? AS3 
can still trace() can't it?
This link should give you an idea of the string limits of different browsers 
and servers:


http://www.boutell.com/newfaq/misc/urllength.html

I have just done that, and here is the pathetically long url:

http://tdc-queuing/test/generic.php?from=Adair,%20OK-Alfalfa,%20OK-Atoka,%20OK-Beaver,%20OK-Beckham,%20OK-Blaine,%20OK-Bryan,%20OK-Caddo,%20OK-Canadian,%20OK-Carter,%20OK-Cherokee,%20OK-Choctaw,%20OK-Cimarron,%20OK-Cleveland,%20OK-Coal,%20OK-Comanche,%20OK-Cotton,%20OK-Craig,%20OK-Creek,%20OK-Custer,%20OK-Delaware,%20OK-Dewey,%20OK-Ellis,%20OK-Garfield,%20OK-Garvin,%20OK-Grady,%20OK-Grant,%20OK-Greer,%20OK-Harmon,%20OK-Harper,%20OK-Haskell,%20OK-Hughes,%20OK-Jackson,%20OK-Jefferson,%20OK-Johnston,%20OK-Kay,%20OK-Kingfisher,%20OK-Kiowa,%20OK-Latimer,%20OK-Le%20Flore,%20OK-Lincoln,%20OK-Logan,%20OK-Love,%20OK-Major,%20OK-Marshall,%20OK-Mayes,%20OK-McClain,%20OK-McCurtain,%20OK-McIntosh,%20OK-Murray,%20OK-Muskogee,%20OK-Noble,%20OK-Nowata,%20OK-Okfuskee,%20OK-Oklahoma,%20OK-Okmulgee,%20OK-Osage,%20OK-Ottawa,%20OK-Pawnee,%20OK-Payne,%20OK-Pittsburg,%20OK-Pontotoc,%20OK-Pottawatomie,%20OK-Pushmataha,%20OK-Roger%20Mills,%20OK-Rogers,%20OK-Seminole,%20OK-Sequoyah,%20OK-Stephens,%20OK-Texas,%20OK-Tillman,%20OK-Tulsa,%20OK-Wagoner,%20OK-Washington,%20OK-Washita,%20OK-Woods,%20OK-Woodward,%20OK&state_colors=0xCC-0xCC-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0x0DCCFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0xFF-0x3333FF-0xFF-0xFF-0xFF

This is generated from the encodeURI() Shawn was talking about. Does this seem 
"well-formed" to you?

Thanks.

Alice
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469227/direct/01/


I can't see anything obviously wrong with the URL really. Is there no way 
instead to send the data as post data from Flash? I know Flash can make post 
requests, but I'm not sure how much more difficult it is.

 I had it using POST before, but from the PHP point of view, it does not matter 
how I make the request, does it? I mean, if the variables are problematic, 
would it matter if I use POST or GET?

Thanks. 





  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469226/direct/01/

RE: [PHP] RE: PHP "GET" Error?

2010-02-25 Thread Alice Wei


> Date: Thu, 25 Feb 2010 15:04:46 -0600
> From: nos...@mckenzies.net
> To: aj...@alumni.iu.edu
> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> Subject: Re: [PHP] RE: PHP "GET" Error?
> 
> Alice Wei wrote:
> > I can't see anything obviously wrong with the URL really. Is there no
> > way instead to send the data as post data from Flash? I know Flash
> > can make post requests, but I'm not sure how much more difficult it
> > is.
> >
> > I had it using POST before, but from the PHP point of view, it does
> > not matter how I make the request, does it? I mean, if the variables
> > are problematic, would it matter if I use POST or GET?
> >
> 
> All seems fine to me.  You can use post, but what's not working?  Try
> trimming back to just 2 from and colors and test it.  What does
> var_dump($_GET) show on the PHP page?
> 
> -Shawn
> 
Too bad that Actionscript does not encode special characters, I had to use 
string replacement to replace it. 
However, now it looks like my PHP is now fine, and my image does display 
correctly. 

Thanks for your help!

Alice
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469227/direct/01/

[PHP] Array Search Problem

2010-03-10 Thread Alice Wei

Hi, 

  I have the code as shown in the following that I am trying to create the 
image of based on the file loaded into the file and additional edits. The 
problem here appears to be that no matter what value I have in the 
$distance_to_destination variable, it does not affect any changes on the map. 
What I am trying to do here is to create a map based on the pre-passed through 
colors of individual states from another program, but I have to match up the 
colors based on the values of the correct states. 

  I figured that I may have problems with 

$key= array_search($location2,$from); //Find out the position of the index 
in the array

$colors_style = ";fill:" . $state_colors[$key];  //Use the index from 
array_search to apply to the color index

Obviously, it is not applying the colors to the states that I would like other 
than doing it one by one as the order of what is in the $from variable. Could 
someone please give me some hints on how I could do the array_search here based 
on the "value" of the values in the $distance_to_distance and apply the color 
to the states?

 $line2) {

$style_line_num = $line_num+3;
$line2 = trim($line2);

  if(preg_match("/^style/",$line2)) {

   $rest = substr($line2,0,-1); 

   for ($j=$line_num;$j<=$style_line_num;$j++){
 if(preg_match("/inkscape:label/",$lines2[$j])) { 
$location = explode("=",$lines2[$j]);
$location2 = substr($location[1],1,-6); 
  
if(in_array($location2, $from)) {
  
 $key= array_search($location2,$from); //Find out the position of 
the index in the array
 $colors_style = ";fill:" . $state_colors[$key];  //Use the index 
from array_search to apply to the color index
 $rest2 = substr($line2,0,-1). $colors_style . "\"";   
 echo $rest2 . "\n";
}
else echo $line2 . "\n";

 } //end preg_match inkscape   
 } //end for loop
   }  //If preg_match style

 else echo $line2 . "\n"; //else if preg_match style
 } //end for each   

fclose($fh);
?>

Thanks for your help.

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469226/direct/01/

[PHP] Array Search Not Working?

2010-03-10 Thread Alice Wei

Hi,

  I have two arrays here that I have combined into a new array, as shown here:

$from = explode("-", $from);
$change = explode("-",$change);
$new_array = array_combine($from,$change);

I then tried reading it from a file and do string matches, trying to find out 
the "key" using the array_search of the individual array elements. I seem to 
have no such luck, even when I copied one of the elements after I do a 
print_r($new_array); 

Here is the code,

foreach ($lines2 as $line_num => $line2) { 
$style_line_num = $line_num+3;

  if(preg_match("/^style/",$line2)) {
   
if(preg_match("/inkscape:label/",$lines2[$style_line_num])) {  
$location = explode("=",$lines2[$style_line_num]);
$location2 = substr($patient_location[1],1,-6);  
 
 if(in_array($location2, $from)) {  
 $key= array_search($location2,$new_array); //Find out the position 
of the index in the array
 echo "Key " . $key . "";  //This only gives me a blank space 
after the word Key
 
} 

 } //end preg_match inkscape   
   }  //If preg_match style

I looked at the example from 
http://php.net/manual/en/function.array-search.php, and looks like what I am 
trying to do here is possible, and yet, why am I not getting a proper key 
return?

Thanks for your help.

Alice
  
_
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/

[PHP] RE: Array Search Not Working?

2010-03-10 Thread Alice Wei

> Date: Wed, 10 Mar 2010 10:09:54 -0600
> From: nos...@mckenzies.net
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: Array Search Not Working?
> 
> Alice Wei wrote:
> > Hi,
> > 
> >   I have two arrays here that I have combined into a new array, as shown 
> > here:
> > 
> > $from = explode("-", $from);
> > $change = explode("-",$change);
> > $new_array = array_combine($from,$change);
> > 
> > I then tried reading it from a file and do string matches, trying to find 
> > out the "key" using the array_search of the individual array elements. I 
> > seem to have no such luck, even when I copied one of the elements after I 
> > do a print_r($new_array); 
> > 
> > Here is the code,
> > 
> > foreach ($lines2 as $line_num => $line2) { 
> > $style_line_num = $line_num+3;
> > 
> >   if(preg_match("/^style/",$line2)) {
> >
> > if(preg_match("/inkscape:label/",$lines2[$style_line_num])) {  
> > $location = explode("=",$lines2[$style_line_num]);
> > $location2 = substr($patient_location[1],1,-6);  
> >  
> >  if(in_array($location2, $from)) {  
> >  $key= array_search($location2,$new_array); //Find out the 
> > position of the index in the array
> >  echo "Key " . $key . "";  //This only gives me a blank 
> > space after the word Key
> >  
> > } 
> > 
> >  } //end preg_match inkscape   
> >}  //If preg_match style
> > 
> > I looked at the example from 
> > http://php.net/manual/en/function.array-search.php, and looks like what I 
> > am trying to do here is possible, and yet, why am I not getting a proper 
> > key return?
> > 
> > Thanks for your help.
> > 
> > Alice
> >   
> > _
> > Hotmail: Powerful Free email with security by Microsoft.
> > http://clk.atdmt.com/GBL/go/201469230/direct/01/
> 
> It's not clear what you are doing, but here is the problem that you are
> asking about.  array_combine() builds an array using the values from
> $from as the keys of the new array and the values from change as the
> values of the new array.
> 
> So here, if $locations2 is a value in the $from array:
> if(in_array($location2, $from)) {
> 
> But here you are searching the values of $new_array which are copies of
> the values from $to.
> $key= array_search($location2,$new_array);
> 
> 
> -- 
> Thanks!
> -Shawn

Here is what I wanted to do:

$from = "Adair, OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, 
OK-Bryan, OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, OK-Choctaw, 
OK-Cimarron, OK-Cleveland, OK-Coal, OK-Comanche, OK-Cotton, OK-Craig, OK-Creek, 
OK-Custer, OK-Delaware, OK-Dewey, OK-Ellis, OK-Garfield, OK-Garvin, OK-Grady, 
OK-Grant, OK-Greer, OK-Harmon, OK-Harper, OK-Haskell, OK-Hughes, OK-Jackson, 
OK-Jefferson, OK-Johnston, OK-Kay, OK-Kingfisher, OK-Kiowa, OK-Latimer, OK-Le 
Flore, OK-Lincoln, OK-Logan, OK-Love, OK-Major, OK-Marshall, OK-Mayes, 
OK-McClain, OK-McCurtain, OK-McIntosh, OK-Murray, OK-Muskogee, OK-Noble, 
OK-Nowata, OK-Okfuskee, OK-Oklahoma, OK-Okmulgee, OK-Osage, OK-Ottawa, 
OK-Pawnee, OK-Payne, OK-Pittsburg, OK-Pontotoc, OK-Pottawatomie, OK-Pushmataha, 
OK-Roger Mills, OK-Rogers, OK-Seminole, OK-Sequoyah, OK-Stephens, OK-Texas, 
OK-Tillman, OK-Tulsa, OK-Wagoner, OK-Washington, OK-Washita, OK-Woods, 
OK-Woodward, OK
";
$state_colors= 
"#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF";
$change= 
"207-158-189-220-134-74.9-174-75.1-38-125-173-215-390-39-141-92.1-121-175-80.1-95.4-191-124-169-101-77-52-117-155-188-176-169-114-158-122-141-107-43-122-181-223-53.7-41.5-131-112-144-147-48-249-141-101-155-81.4-158-92.3-16.3-105-153-186-108-69.2-146-103-53.4-225-140-136-80.4-179-93.3-277-136-110-136-143-103-183-141";;

$from = explode("-", $from);
$state_colors= explode("

[PHP] RE: Array Search Not Working?

2010-03-10 Thread Alice Wei

From: aj...@alumni.iu.edu
To: nos...@mckenzies.net
CC: php-general@lists.php.net
Subject: RE: Array Search Not Working?
Date: Wed, 10 Mar 2010 11:21:26 -0500








> Date: Wed, 10 Mar 2010 10:09:54 -0600
> From: nos...@mckenzies.net
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: Array Search Not Working?
> 
> Alice Wei wrote:
> > Hi,
> > 
> >   I have two arrays here that I have combined into a new array, as shown 
> > here:
> > 
> > $from = explode("-", $from);
> > $change = explode("-",$change);
> > $new_array = array_combine($from,$change);
> > 
> > I then tried reading it from a file and do string matches, trying to find 
> > out the "key" using the array_search of the individual array elements. I 
> > seem to have no such luck, even when I copied one of the elements after I 
> > do a print_r($new_array); 
> > 
> > Here is the code,
> > 
> > foreach ($lines2 as $line_num => $line2) { 
> > $style_line_num = $line_num+3;
> > 
> >   if(preg_match("/^style/",$line2)) {
> >
> > if(preg_match("/inkscape:label/",$lines2[$style_line_num])) {  
> > $location = explode("=",$lines2[$style_line_num]);
> > $location2 = substr($patient_location[1],1,-6);  
> >  
> >  if(in_array($location2, $from)) {  
> >  $key= array_search($location2,$new_array); //Find out the 
> > position of the index in the array
> >  echo "Key " . $key . "";  //This only gives me a blank 
> > space after the word Key
> >  
> > } 
> > 
> >  } //end preg_match inkscape   
> >}  //If preg_match style
> > 
> > I looked at the example from 
> > http://php.net/manual/en/function.array-search.php, and looks like what I 
> > am trying to do here is possible, and yet, why am I not getting a proper 
> > key return?
> > 
> > Thanks for your help.
> > 
> > Alice
> >   
> > _
> > Hotmail: Powerful Free email with security by Microsoft.
> > http://clk.atdmt.com/GBL/go/201469230/direct/01/
> 
> It's not clear what you are doing, but here is the problem that you are
> asking about.  array_combine() builds an array using the values from
> $from as the keys of the new array and the values from change as the
> values of the new array.
> 
> So here, if $locations2 is a value in the $from array:
> if(in_array($location2, $from)) {
> 
> But here you are searching the values of $new_array which are copies of
> the values from $to.
> $key= array_search($location2,$new_array);
> 
> 
> -- 
> Thanks!
> -Shawn

Hi, 

Looks like I have figured out how to get it to sort numerically after the print 
out , but still I cannot get it to do the array_search to find out the index of 
the "element" in this "new_array". 

Here is the code, 

$from = "Adair, OK-Alfalfa, OK-Atoka, OK-Beaver, OK-Beckham, OK-Blaine, 
OK-Bryan, OK-Caddo, OK-Canadian, OK-Carter, OK-Cherokee, OK-Choctaw, 
OK-Cimarron, OK-Cleveland, OK-Coal, OK-Comanche, OK-Cotton, OK-Craig, OK-Creek, 
OK-Custer, OK-Delaware, OK-Dewey, OK-Ellis, OK-Garfield, OK-Garvin, OK-Grady, 
OK-Grant, OK-Greer, OK-Harmon, OK-Harper, OK-Haskell, OK-Hughes, OK-Jackson, 
OK-Jefferson, OK-Johnston, OK-Kay, OK-Kingfisher, OK-Kiowa, OK-Latimer, OK-Le 
Flore, OK-Lincoln, OK-Logan, OK-Love, OK-Major, OK-Marshall, OK-Mayes, 
OK-McClain, OK-McCurtain, OK-McIntosh, OK-Murray, OK-Muskogee, OK-Noble, 
OK-Nowata, OK-Okfuskee, OK-Oklahoma, OK-Okmulgee, OK-Osage, OK-Ottawa, 
OK-Pawnee, OK-Payne, OK-Pittsburg, OK-Pontotoc, OK-Pottawatomie, OK-Pushmataha, 
OK-Roger Mills, OK-Rogers, OK-Seminole, OK-Sequoyah, OK-Stephens, OK-Texas, 
OK-Tillman, OK-Tulsa, OK-Wagoner, OK-Washington, OK-Washita, OK-Woods, 
OK-Woodward, OK
";
$state_colors= 
"#CC-#CC-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#FF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF-#0DCCFF";
$change= 
"207-158-189-220

[PHP] RE: Array Search Not Working?

2010-03-10 Thread Alice Wei

> 
> I'm still a little foggy on what you're doing, but doing, but does this
> help?
> 
> $from = explode("-", $from);
> $state_colors = explode("-", $state_colors);
> $change = explode("-", $change);
> 
> $old = array_combine($from, $state_colors);
> $new = array_combine($from, $change);
> 
> //show all values
> foreach($old as $key => $val) {
>   echo "{$key}  old={$old[$key]}  new={$new[$key]}\n";
> }
> 
> //lookup a particular value
> $test = "Muskogee, OK";
> echo "TEST={$test}  old={$old[$test]}  new={$new[$test]}\n";
> 

Well, here is the weird part. put up the last 3 lines of your code here into 
mine, and here is the output:TEST=Muskogee, OK old= new= 
I am starting to wonder if there are other things hidden inside the "values" 
that seems like that the values of the new array (the state and counties part) 
are the same as the original when I tried to do the comparison. This is what I 
mean by the fact that my array_search does not work, and all I am trying to do 
is to find the index, so I can do stateColors[$index] later on and color my 
map. 

Have I done something wrong here that causes the code you provided not to spit 
out anything here? This is what I have:

$from = explode("-", $from);
$state_colors= explode("-", $state_colors);
$change = explode("-",$change);

$new_array = array_combine($from,$change);
asort($new_array);

foreach ($new_array as $key => $value) echo $key . " is " . $value . " miles 
away";

Thanks. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469226/direct/01/

RE: [PHP] Array Search Problem

2010-03-10 Thread Alice Wei

> 
> did you read the help for those functions on php.net?

Yes, I found a "recursive" way to find out the "index" like I wanted, by doing 
something like 

$from = explode("-", $from);
$state_colors= explode("-", $state_colors);
$change = explode("-",$change);

$count = count($new_array);
$i=0;
foreach ($new_array as $key => $value){
 echo $i . " " . $key . " is " . $value . " miles away";
 $i++;
}

You can see it is not very elegant, and plus, I created the $new_array so I 
could do the ordering according to the values of the change array. I can tell 
that since this is not a single array, which is probably why array_search does 
not work. 
Since I don't need the "value" of my "new_array" here, I am still finding out 
how to "strip off" the values here without having to flatten my array. Is what 
I am trying to do here possible? Or, is there a trick in array_search that I 
could use to find the index without having to strip off anything?

Thanks for your help.

Alice

> 
> On Wed, Mar 10, 2010 at 4:12 PM, Alice Wei  wrote:
> >
> > Hi,
> >
> >  I have the code as shown in the following that I am trying to create the 
> > image of based on the file loaded into the file and additional edits. The 
> > problem here appears to be that no matter what value I have in the 
> > $distance_to_destination variable, it does not affect any changes on the 
> > map. What I am trying to do here is to create a map based on the pre-passed 
> > through colors of individual states from another program, but I have to 
> > match up the colors based on the values of the correct states.
> >
> >  I figured that I may have problems with
> >
> >$key= array_search($location2,$from); //Find out the position of the 
> > index in the array
> >
> >$colors_style = ";fill:" . $state_colors[$key];  //Use the index from 
> > array_search to apply to the color index
> >
> > Obviously, it is not applying the colors to the states that I would like 
> > other than doing it one by one as the order of what is in the $from 
> > variable. Could someone please give me some hints on how I could do the 
> > array_search here based on the "value" of the values in the 
> > $distance_to_distance and apply the color to the states?
> >
> >  >
> > header("Content-type: image/svg+xml"); //Outputting an SVG
> >
> > $from = $_GET['from'];
> > $state_colors= $_GET['state_colors'];
> > $distance_to_destination= $_GET['distance_to_destination'];
> >
> > $from = explode("-", $from);
> > $state_colors= explode("-", $state_colors);
> > $change = explode("-",$change);
> >
> > #Load the Map
> > $ourFileName= "USA_Counties_with_FIPS_and_names.svg";
> > $fh = fopen($ourFileName, "r") or die("Can't open file");
> > $contents = fread($fh,filesize($ourFileName));
> > $lines2= file($ourFileName);
> >
> > foreach ($lines2 as $line_num => $line2) {
> >
> > $style_line_num = $line_num+3;
> > $line2 = trim($line2);
> >
> >  if(preg_match("/^style/",$line2)) {
> >
> >   $rest = substr($line2,0,-1);
> >
> >   for ($j=$line_num;$j<=$style_line_num;$j++){
> > if(preg_match("/inkscape:label/",$lines2[$j])) {
> >$location = explode("=",$lines2[$j]);
> >$location2 = substr($location[1],1,-6);
> >
> >if(in_array($location2, $from)) {
> >
> >     $key= array_search($location2,$from); //Find out the position 
> > of the index in the array
> > $colors_style = ";fill:" . $state_colors[$key];  //Use the 
> > index from array_search to apply to the color index
> > $rest2 = substr($line2,0,-1). $colors_style . "\"";
> > echo $rest2 . "\n";
> >}
> >else echo $line2 . "\n";
> >
> > } //end preg_match inkscape
> > } //end for loop
> >   }  //If preg_match style
> >
> > else echo $line2 . "\n"; //else if preg_match style
> >  } //end for each
> >
> > fclose($fh);
> > ?>
> >
> > Thanks for your help.
> >
> > Alice
> >
> > _
> > Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
> > http://clk.atdmt.com/GBL/go/201469226/direct/01/
  
_
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/

RE: [PHP] Array Search Problem

2010-03-11 Thread Alice Wei

Hi, 

  At the time when I am writing this, looks like I already got the functions I 
needed. It turned out that I had to use some array_combine, sorting the items 
by keys instead of values as well as using array_keys to get the values I 
needed. 

Thanks for pointing me towards the right direction. 

Alice


> From: rene7...@gmail.com
> Date: Thu, 11 Mar 2010 07:12:15 +0100
> Subject: Re: [PHP] Array Search Problem
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> (almost) all the tricks are in the comments of the help page for a
> function, on php.net
> 
> but all functions accept only a given (and usually documented) set of
> parameter(type)s, so you'll probably have to prepare the var, or even
> call the function in a loop, outputting to yet another descriptively
> named array that'll be used as "wanted list" later in the code.
> 
> On Wed, Mar 10, 2010 at 6:57 PM, Alice Wei  wrote:
> >>
> >> did you read the help for those functions on php.net?
> >
> > Yes, I found a "recursive" way to find out the "index" like I wanted, by
> > doing something like
> >
> > $from = explode("-", $from);
> > $state_colors= explode("-", $state_colors);
> > $change = explode("-",$change);
> >
> > $count = count($new_array);
> > $i=0;
> > foreach ($new_array as $key => $value){
> >  echo $i . " " . $key . " is " . $value . " miles away";
> >  $i++;
> > }
> >
> > You can see it is not very elegant, and plus, I created the $new_array so I
> > could do the ordering according to the values of the change array. I can
> > tell that since this is not a single array, which is probably why
> > array_search does not work.
> > Since I don't need the "value" of my "new_array" here, I am still finding
> > out how to "strip off" the values here without having to flatten my array.
> > Is what I am trying to do here possible? Or, is there a trick in
> > array_search that I could use to find the index without having to strip off
> > anything?
> >
> > Thanks for your help.
> >
> > Alice
> >
> >>
> >> On Wed, Mar 10, 2010 at 4:12 PM, Alice Wei  wrote:
> >> >
> >> > Hi,
> >> >
> >> >  I have the code as shown in the following that I am trying to create
> >> > the image of based on the file loaded into the file and additional edits.
> >> > The problem here appears to be that no matter what value I have in the
> >> > $distance_to_destination variable, it does not affect any changes on the
> >> > map. What I am trying to do here is to create a map based on the 
> >> > pre-passed
> >> > through colors of individual states from another program, but I have to
> >> > match up the colors based on the values of the correct states.
> >> >
> >> >  I figured that I may have problems with
> >> >
> >> >$key= array_search($location2,$from); //Find out the position of the
> >> > index in the array
> >> >
> >> >$colors_style = ";fill:" . $state_colors[$key];  //Use the index from
> >> > array_search to apply to the color index
> >> >
> >> > Obviously, it is not applying the colors to the states that I would like
> >> > other than doing it one by one as the order of what is in the $from
> >> > variable. Could someone please give me some hints on how I could do the
> >> > array_search here based on the "value" of the values in the
> >> > $distance_to_distance and apply the color to the states?
> >> >
> >> >  >> >
> >> > header("Content-type: image/svg+xml"); //Outputting an SVG
> >> >
> >> > $from = $_GET['from'];
> >> > $state_colors= $_GET['state_colors'];
> >> > $distance_to_destination= $_GET['distance_to_destination'];
> >> >
> >> > $from = explode("-", $from);
> >> > $state_colors= explode("-", $state_colors);
> >> > $change = explode("-",$change);
> >> >
> >> > #Load the Map
> >> > $ourFileName= "USA_Counties_with_FIPS_and_names.svg";
> >> > $fh = fopen($ourFileName, "r") or die("Can't open file");
> >> > $contents = fread($fh,filesize($ourFileName));
> >> > $lines2= file($ourFileName);
> >> >
> >>

[PHP] Mail Function Problem

2010-04-11 Thread Alice Wei

Hi, 

I have an issue here where I see no PHP errors on my mail function usage, and 
yet I am not getting the mail in the desired account. Here is what I have for 
my PHP code:

$headers = "From: aj...@alumni.iu.edu";
$to = "aj...@alumni.iu.edu ";
$subject = "Comments Regarding My Studio";
$body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n 
Comments:\n $comments";
mail($to, $subject, $body,$headers);

This is what I have in my PHP.ini:

[mail function]
; For Win32 only.
SMTP = smtp.live.com
smtp_port = 587

; For Win32 only.
sendmail_from = aj...@alumni.iu.edu

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra 
parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the 
list please give me some pointers on what I may have done wrong here?
Thanks for your help.
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei


> From: peter.e.l...@gmail.com
> Date: Mon, 12 Apr 2010 13:09:48 +0200
> Subject: Re: [PHP] Mail Function Problem
> To: k...@daleco.biz
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> 
> On 12 April 2010 05:22, Kevin Kinsey  wrote:
> >
> > Thanks to the worldwide brotherhood of crooks known as spammers,
> > sending e-mail these days isn't nearly as easy as PHP makes it look.
> > You might wanna look into an "errors-to" header to help debug any
> > problems with sender authorization, bad ports, etc.
> >
> 
> Along these lines: there's a chance that sending a mail from yourself,
> to yourself, through PHP like this, will cause mail servers to think
> it's spam. For testing email sending, normal scenarios are better
> (i.e. send an email to another account).
> 
> Regards
> Peter
> 
> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 

I have changed my $to to $email, so it is not the same email address as the 
$from. I also added Kevin's lines with the parameters that April suggested, and 
it looks like I still get Sending Mail failed. Which function should I use to 
find out why my sending mail failed?

Thanks for your help.

Alice
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei


Date: Mon, 12 Apr 2010 15:26:46 +0400
Subject: Re: [PHP] Mail Function Problem
From: a.bovane...@gmail.com
To: aj...@alumni.iu.edu
CC: php-general@lists.php.net

Hi!
You have the following php.ini params:SMTP = smtp.live.com

smtp_port = 587
live.com not support relay and it requires authentication.

Is there an email account that I could try? I thought most email accounts 
requires authentication anyway.


Thanks for your help.

Alice

On Mon, Apr 12, 2010 at 6:33 AM, Alice Wei  wrote:



Hi,



I have an issue here where I see no PHP errors on my mail function usage, and 
yet I am not getting the mail in the desired account. Here is what I have for 
my PHP code:



$headers = "From: aj...@alumni.iu.edu";

$to = "aj...@alumni.iu.edu ";

$subject = "Comments Regarding My Studio";

$body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n 
Comments:\n $comments";

mail($to, $subject, $body,$headers);



This is what I have in my PHP.ini:



[mail function]

; For Win32 only.

SMTP = smtp.live.com

smtp_port = 587



; For Win32 only.

sendmail_from = aj...@alumni.iu.edu



; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").

;sendmail_path =



; Force the addition of the specified parameters to be passed as extra 
parameters

; to the sendmail binary. These parameters will always replace the value of

; the 5th parameter to mail(), even in safe mode.

;mail.force_extra_parameters =



Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the 
list please give me some pointers on what I may have done wrong here?

Thanks for your help.



_

The New Busy is not the old busy. Search, chat and e-mail from your inbox.

http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3


-- 
With regards,
Alexei Bovanenko

  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei






> Date: Mon, 12 Apr 2010 11:09:42 -0500
> From: k...@daleco.biz
> To: aj...@alumni.iu.edu
> CC: a.bovane...@gmail.com; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Problem
> 
> Alice Wei wrote:
> >> Hi!
> >> You have the following php.ini params:SMTP = smtp.live.com
> >> 
> >> smtp_port = 587
> >> live.com not support relay and it requires authentication.
> > 
> > Is there an email account that I could try? I thought 
>  > most email accounts requires authentication anyway.
> 
> Well, "therein lies the rub," as the Bard said (maybe).
> PHP's mail() was built on a general assumption that
> there would be a local SMTP server.  It supports remote
> SMTP, but I'm not aware of any ability to do SMTP auth,
> even in the PEAR packages.
> 
> You might just wanna read up on mail in general.  The
> php.net/mail page lists several relevant RFC's, and
> has links to most of the PEAR mail classes, etc.
> 
> You should definitely read up on live.com's email
> configuration.  If they use SMTP auth, I'm not sure
> you can do this (per above).  If it uses, say, "POP
> before SMTP" for authorization, you might be able to
> hack something together with the PHP IMAP functions, or
> even sockets, but you're getting into a big lotta work
> for what seems a small thing.
> 

This is what I am talking about. 
Two years ago when I first set up my own server with Linux and not Windows, I 
never had to deal with this. 
Perhaps the authentication has since then got stricter, but it should not be so 
much of a heck of a deal. 

I found this doc from ATT's website, 
http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, so obviously the 
smtp server I provided earlier is probably not up to date. 

I think I will fiddle around with the php.ini file and see what else is there. 
Thanks.

Alice
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei






Hi, 

 Thanks to everyone's suggestions, I have followed some instructions from 
http://www.geeksengine.com/article/install-pear-on-windows.html and attempted 
to install PEAR. The problem is, when I do a test page, which only has:

. utor

It only gives me a blank page, with no errors. Has anyone who succeeded with 
using PEAR on PHP can guide me on a good tutorial to read?

Thanks for your help.

Alice
> Date: Mon, 12 Apr 2010 15:54:05 -0500
> From: k...@daleco.biz
> To: kranthi...@gmail.com
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Problem
> 
> kranthi wrote:
> > PEAR's mail package does support authentication.
> > http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
> > 
> 
> I will say "mea culpa" on this one; apparently I didn't
> dig deep enough into the PEAR docs to figure this out.
> It's certainly not mentioned on the manpage at php.net,
> but, of course, the PEAR stuff is elsewhere.  I read over
> the first page linked from the PHP manpage, so it must
> nks ve been a lil' deeper than that.  If it's only available
> at about.com (lol), I'd suggest filing a PR with the PEAR
> folk's documentation team, eh?
> 
> But, this time I'll do what I shoulda mentioned before and
> include the "IANAE" disclaimer on all things PEAR, many
> things PHP, and some things SMTP.
> 
> Kevin Kinsey
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei

> Date: Mon, 12 Apr 2010 15:54:05 -0500
> From: k...@daleco.biz
> To: kranthi...@gmail.com
> CC: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Problem
> 
> kranthi wrote:
> > PEAR's mail package does support authentication.
> > http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
> > 
> 
> I will say "mea culpa" on this one; apparently I didn't
> dig deep enough into the PEAR docs to figure this out.
> It's certainly not mentioned on the manpage at php.net,
> but, of course, the PEAR stuff is elsewhere.  I read over
> the first page linked from the PHP manpage, so it must
> have been a lil' deeper than that.  If it's only available
> at about.com (lol), I'd suggest filing a PR with the PEAR
> folk's documentation team, eh?
> 
> But, this time I'll do what I shoulda mentioned before and
> include the "IANAE" disclaimer on all things PEAR, many
> things PHP, and some things SMTP.
> 
> Kevin Kinsey

I tried installing the Pear Mail package, it is now located in php/PEAR/Mail, 
and my code is located in the htdocs. Here is the code:

require_once("Mail.php");
$mail = Mail::factory("mail");

$your_name = $_POST['your_name'];
$email = $_POST['email'];
$question = $_POST['question'];
$comments= $_POST['comments'];
$submit = $_POST['submit'];

if($_POST['submit']=="Submit") {
$from = "elite.engl...@att.net";
$to =  $email;
$subject = "Comments Regarding HH Web Design Studio";
$body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n 
Comments:\n $comments";

$host = "smtp.att.yahoo.com";
$username = "my_user_name";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$mail->send($to, $headers, $body);

if (PEAR::isError($mail)) echo "" . $mail->getMessage() . "";

This is what I get: 

Fatal error:  Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
 on line 30

Do I need to move the Mail PEAR class to the same folder as my web folder? How 
can I make sure that my Pear is running?
Thanks for your help.

Alice
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Mail Function Problem

2010-04-12 Thread Alice Wei

> From: kranthi...@gmail.com
> Date: Tue, 13 Apr 2010 07:41:19 +0530
> Subject: Re: [PHP] Mail Function Problem
> To: aj...@alumni.iu.edu
> CC: k...@daleco.biz; php-general@lists.php.net
> 
> thats weired...
> Mail.php contains the class Mail. So getting a "class not found" error
> is not possible... (require_once stops the script in case it can't
> find Mail.php)
> >> Do I need to move the Mail PEAR class to the same folder as my web folder
> ensure that C:/xampp/php/PEAR folder is added to your include list

I thought so too, this is what I have in my php.ini:

; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path
include_path = ".;C:\xampp\php\PEAR"

This is the contents of my C:\xampp\php\PEAR\Mail:
mail.php
mime.php
mimeDecode.php
mimePart.php
null.php
RFC822.php
sendmail.php
smtp.php

Unless, I have to do require_once("mail.php")?
I am getting confused. 

Alice

  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Mail Function Problem

2010-04-13 Thread Alice Wei


Subject: RE: [PHP] Mail Function Problem
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: k...@daleco.biz; a.bovane...@gmail.com; php-general@lists.php.net
Date: Tue, 13 Apr 2010 13:19:15 +0100






  
  


On Mon, 2010-04-12 at 12:25 -0400, Alice Wei wrote:






> Date: Mon, 12 Apr 2010 11:09:42 -0500
> From: k...@daleco.biz
> To: aj...@alumni.iu.edu
> CC: a.bovane...@gmail.com; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Problem
> 
> Alice Wei wrote:
> >> Hi!
> >> You have the following php.ini params:SMTP = smtp.live.com
> >> 
> >> smtp_port = 587
> >> live.com not support relay and it requires authentication.
> > 
> > Is there an email account that I could try? I thought 
>  > most email accounts requires authentication anyway.
> 
> Well, "therein lies the rub," as the Bard said (maybe).
> PHP's mail() was built on a general assumption that
> there would be a local SMTP server.  It supports remote
> SMTP, but I'm not aware of any ability to do SMTP auth,
> even in the PEAR packages.
> 
> You might just wanna read up on mail in general.  The
> php.net/mail page lists several relevant RFC's, and
> has links to most of the PEAR mail classes, etc.
> 
> You should definitely read up on live.com's email
> configuration.  If they use SMTP auth, I'm not sure
> you can do this (per above).  If it uses, say, "POP
> before SMTP" for authorization, you might be able to
> hack something together with the PHP IMAP functions, or
> even sockets, but you're getting into a big lotta work
> for what seems a small thing.
> 

This is what I am talking about. 
Two years ago when I first set up my own server with Linux and not Windows, I 
never had to deal with this. 
Perhaps the authentication has since then got stricter, but it should not be so 
much of a heck of a deal. 

I found this doc from ATT's website, 
http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, so obviously the 
smtp server I provided earlier is probably not up to date. 

I think I will fiddle around with the php.ini file and see what else is there. 
Thanks.

Alice
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1




Linux installations come with sendmail which allows you to send email directly. 
Windows doesn't have this as part of the base setup, but I believe if you can 
install a local mail server then this should fix the issue.

Something like http://www.hmailserver.com/? I use AT&T, why is it that I use 
their SMTP server and my From address in PHP.ini file didn't work?

Thanks. 

Alice






Thanks,sh

http://www.ashleysheridan.co.uk







  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

[PHP] Mail Function Using PEAR Issues

2010-04-18 Thread Alice Wei

Hi,

  After several days, I have rebuilt my system on Linux using Ubuntu, installed 
PEAR and such. Thankfully, when I execute the code, it no longer gives me the 
error that the class is not found. Yet, when I submit the form now, I can 
always see the confirmation message telling me that my message has been sent, 
but I cannot see it even in another mailbox. 

Here is the code:

require_once("Mail.php");
$mail = Mail::factory("mail");

$your_name = $_POST['your_name'];
$email = $_POST['email'];
$question = $_POST['question'];
$comments= $_POST['comments'];
$submit = $_POST['submit'];

$from = "localhost";
$to =  $email;
$subject = "Comments";
$body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n 
Comments:\n $comments";

$host = "localhost";
$headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
$mail ->send($to, $headers, $body);
if (PEAR::isError($mail)) echo "" . $mail->getMessage() . "";
else {
   echo "Message successfully sent!  
   Thank You For Contacting Us
   We will contact you within the next 24 business hours.
   Here is what you have input:
   Your Name is " . $your_name .  "
   Your Email is " . $email . "
   You contacted us because you have a " . $question . "
   Here are your comments: " . $comments . "
 Have a Nice Day!";
  } 
}

Can anyone on the list please give me some pointers on what might have been 
wrong here? I have not edited anything in the php.ini file regarding SMTP. 

Thanks.
 
Alice



  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Mail Function Using PEAR Issues

2010-04-18 Thread Alice Wei


> Date: Sun, 18 Apr 2010 21:02:29 -0500
> From: k...@daleco.biz
> To: aj...@alumni.iu.edu
> CC: k...@designdrumm.com; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> 
> Karl DeSaulniers wrote:
> > Hey Alice,
> > Again, try throwing the MIME in.
> > 
> > $headers  = 'MIME-Version: 1.0' . "\r\n";
> > $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
> 
> Also:
> 
> $headers .= 'Errors-to: ' . "\r\n";
> 
>Which I suggested on your previous thread.  Also, I see you have
> $from set to equal "localhost".  Many SMTP servers will reject this
> I *think*, because "localhost" is a hostname, not a working mailbox.
> Try making $from equal to a real working address - possibly the same
> one as your "Errors-to:" header..
> 
> My $0.02,
> 
> KDK
> 
> > 
> > On Apr 18, 2010, at 10:11 AM, Alice Wei wrote:
> > 
> >>
> >> Hi,
> >>
> >>   After several days, I have rebuilt my system on Linux using Ubuntu, 
> >> installed PEAR and such. Thankfully, when I execute the code, it no 
> >> longer gives me the error that the class is not found. Yet, when I 
> >> submit the form now, I can always see the confirmation message telling 
> >> me that my message has been sent, but I cannot see it even in another 
> >> mailbox.
> >>
> >> Here is the code:
> >>
> >> require_once("Mail.php");
> >> $mail = Mail::factory("mail");
> >>
> >> $your_name = $_POST['your_name'];
> >> $email = $_POST['email'];
> >> $question = $_POST['question'];
> >> $comments= $_POST['comments'];
> >> $submit = $_POST['submit'];
> >>
> >> $from = "localhost";
> >> $to =  $email;
> >> $subject = "Comments";
> >> $body = "From: $your_name\n E-Mail: $email\n Reason Contact: 
> >> $question\n Comments:\n $comments";
> >>
> >> $host = "localhost";
> >> $headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
> >> $mail ->send($to, $headers, $body);
> >> if (PEAR::isError($mail)) echo "" . $mail->getMessage() . "";
> >> else {
> >>echo "Message successfully sent! 
> >>Thank You For Contacting Us
> >>We will contact you within the next 24 business 
> >> hours.
> >>Here is what you have input:
> >>Your Name is " . $your_name .  "
> >>Your Email is " . $email . "
> >>You contacted us because you have a " . $question . 
> >> "
> >>Here are your comments: " . $comments . "
> >>  Have a Nice Day!";
> >>   }
> >> }
> >>
> >> Can anyone on the list please give me some pointers on what might have 
> >> been wrong here? I have not edited anything in the php.ini file 
> >> regarding SMTP.
> >>
> >> Thanks.
> >>
> >> Alice
> 

Hi, 

Here is the revised version, and I don't think I have experienced any changes 
in terms of the output on the screen. Plus, I still get no email. 

' . "\r\n";

$mail ->send($to, $headers, $body);

if (PEAR::isError($mail)) echo "" . $mail->getMessage() . 
"";

else {

   echo "Message successfully sent!  

   Thank You For Contacting Us

   Here is what you have input:

   Your Name is " . $your_name .  
"

   Your Email is " . $email . 
"

   You contacted us because you have a " . 
$question . "

   Here are your comments: " . $comments . 
"

 Have a Nice Day!";

  } 


I have made sure that my $from and $to addresses are different, Could there be 
anything else wrong here? I have not edited anything in php.ini regarding this 
issue. Would I need to?

Thanks for your help.

Alice
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Mail Function Using PEAR Issues

2010-04-19 Thread Alice Wei

 > Date: Sun, 18 Apr 2010 21:39:19 -0500
> From: k...@daleco.biz
> To: aj...@alumni.iu.edu
> CC: k...@designdrumm.com; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> 
> Alice Wei wrote:
> > 
> >> Date: Sun, 18 Apr 2010 21:02:29 -0500
> >> From: k...@daleco.biz
> >> To: aj...@alumni.iu.edu
> >> CC: k...@designdrumm.com; php-general@lists.php.net
> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >>
> >> Karl DeSaulniers wrote:
> >>> Hey Alice,
> >>> Again, try throwing the MIME in.
> >>>
> >>> $headers  = 'MIME-Version: 1.0' . "\r\n";
> >>> $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
> >> Also:
> >>
> >> $headers .= 'Errors-to: ' . "\r\n";
> >>
> >>Which I suggested on your previous thread.  Also, I see you have
> >> $from set to equal "localhost".  Many SMTP servers will reject this
> >> I *think*, because "localhost" is a hostname, not a working mailbox.
> >> Try making $from equal to a real working address - possibly the same
> >> one as your "Errors-to:" header..
> >>
> >> My $0.02,
> >>
> >> KDK
> >>
> >>> On Apr 18, 2010, at 10:11 AM, Alice Wei wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>>   After several days, I have rebuilt my system on Linux using Ubuntu, 
> >>>> installed PEAR and such. Thankfully, when I execute the code, it no 
> >>>> longer gives me the error that the class is not found. Yet, when I 
> >>>> submit the form now, I can always see the confirmation message telling 
> >>>> me that my message has been sent, but I cannot see it even in another 
> >>>> mailbox.
> >>>>
> >>>> Here is the code:
> >>>>
> >>>> require_once("Mail.php");
> >>>> $mail = Mail::factory("mail");
> >>>>
> >>>> $your_name = $_POST['your_name'];
> >>>> $email = $_POST['email'];
> >>>> $question = $_POST['question'];
> >>>> $comments= $_POST['comments'];
> >>>> $submit = $_POST['submit'];
> >>>>
> >>>> $from = "localhost";
> >>>> $to =  $email;
> >>>> $subject = "Comments";
> >>>> $body = "From: $your_name\n E-Mail: $email\n Reason Contact: 
> >>>> $question\n Comments:\n $comments";
> >>>>
> >>>> $host = "localhost";
> >>>> $headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
> >>>> $mail ->send($to, $headers, $body);
> >>>> if (PEAR::isError($mail)) echo "" . $mail->getMessage() . "";
> >>>> else {
> >>>>echo "Message successfully sent! 
> >>>>Thank You For Contacting Us
> >>>>We will contact you within the next 24 business 
> >>>> hours.
> >>>>Here is what you have input:
> >>>>Your Name is " . $your_name .  "
> >>>>Your Email is " . $email . "
> >>>>You contacted us because you have a " . $question . 
> >>>> "
> >>>>Here are your comments: " . $comments . "
> >>>>  Have a Nice Day!";
> >>>>   }
> >>>> }
> >>>>
> >>>> Can anyone on the list please give me some pointers on what might have 
> >>>> been wrong here? I have not edited anything in the php.ini file 
> >>>> regarding SMTP.
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Alice
> > 
> > Hi, 
> > 
> > Here is the revised version, and I don't think I have experienced any  
>  > changes in terms of the output on the screen. Plus, I still get no email.
> > 
> >  > 
> > require_once("Mail.php");
> > $mail = Mail::factory("mail");
> > $your_name = $_POST['your_name'];
> > $email = $_POST['email'];
> > $question = $_POST['question'];
> > $comments= $_POST['comments'];
> > $submit = 

RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


> From: peter.e.l...@gmail.com
> Date: Mon, 19 Apr 2010 10:15:08 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> Most, if not all, mail servers keep log files. You should look for the
> log files to see if the mail server has sent your mail properly or is
> experiencing problems (those may not feed back into PHP).
> 
> Regards
> Peter
> 
> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 

You know where I can find that? I use Evolution Mail, a mail server? I found it 
through Ubuntu yesterday. Here is the link: 
http://projects.gnome.org/evolution/ It asks me to put in the type of mail 
service I used, it grabbed Google, which is smtp.google.com. I still cannot 
send mail. I start to wonder what is going on. 

Alice
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


Subject: Re: [PHP] Mail Function Using PEAR Issues
From: a...@ashleysheridan.co.uk
To: peter.e.l...@gmail.com
CC: aj...@alumni.iu.edu; php-general@lists.php.net
Date: Tue, 20 Apr 2010 21:16:03 +0100






  
  


On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

On 20 April 2010 20:17, Alice Wei  wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-general@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> 
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> 
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51





If you've got Pear on Ubuntu, can Pear not default to sendmail if no SMTP 
connection is set up?


Well, from my experience with Ubuntu, looks like that it does not do that. 
Unless, I am doing it wrong?






Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


Subject: Re: [PHP] Mail Function Using PEAR Issues
From: a...@ashleysheridan.co.uk
To: peter.e.l...@gmail.com
CC: aj...@alumni.iu.edu; php-general@lists.php.net
Date: Tue, 20 Apr 2010 21:16:03 +0100






  
  


On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

On 20 April 2010 20:17, Alice Wei  wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-general@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> 
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> 
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51





If you've got Pear on Ubuntu, can Pear not default to sendmail if no SMTP 
connection is set up?


Well, from my experience with Ubuntu, looks like that it does not do that. 
Unless, I am doing it wrong?






Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Mail Function Using PEAR Issues

2010-04-21 Thread Alice Wei

> From: peter.e.l...@gmail.com
> Date: Wed, 21 Apr 2010 09:29:19 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> 
> On 21 April 2010 04:25, Alice Wei  wrote:
> > Well, from my experience with Ubuntu, looks like that it does not do that. 
> > Unless, I am doing it wrong?
> 
> So did you try using the 'smtp' backend and passing all the connection
> details rather than 'mail'?
> 
I have mentioned several posts earlier that I have done nothing about my 
php.ini file. From what you said, since I use U-Verse, am I supposed to do 
something as described here: 
http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf
 
I thought with PEAR, you don't need to do that anymore. Or, am I wrong?
 
Alice
 
 
 
 
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Mail Function Using PEAR Issues

2010-04-21 Thread Alice Wei

> From: peter.e.l...@gmail.com
> Date: Wed, 21 Apr 2010 21:51:31 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> 
> On 21 April 2010 18:44, Alice Wei  wrote:
> > I have mentioned several posts earlier that I have done nothing about my
> > php.ini file. From what you said, since I use U-Verse, am I supposed to do
> > something as described here:
> > http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf
> >
> >
> >
> > I thought with PEAR, you don't need to do that anymore. Or, am I wrong?
> >
> 
> Read the PEAR documentation:
> http://pear.php.net/manual/en/package.mail.mail.factory.php
> You can use other backends than just 'mail' - try using the smtp and
> fill in your smtp settings as needed.
> 
> Regards
> Peter
> 
I saw something like that on 
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm,
 and this is probably what you are talking about?

 $smtp = Mail::factory('smtp',
   array ('host' => $host,
 'auth' => true,
 'username' => $username,
 'password' => $password));
Do I still need to install a mail server? I have Evolution Mail on my Linux 
box, and looks like that is a client and not a server. 
Or, can I use any of the mail smtp setup, like Google? Or, do use some 
authentication information from 
http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, since I use 
U-Verse at home? 

Thanks for your help.

Alice
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Mail Function Using PEAR Issues

2010-04-21 Thread Alice Wei

> Date: Wed, 21 Apr 2010 22:01:03 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> 
> On 21 April 2010 21:58, Alice Wei  wrote:
> >> From: peter.e.l...@gmail.com
> >> Date: Wed, 21 Apr 2010 21:51:31 +0200
> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >> To: aj...@alumni.iu.edu
> >> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> >>
> >> On 21 April 2010 18:44, Alice Wei  wrote:
> >> > I have mentioned several posts earlier that I have done nothing about my
> >> > php.ini file. From what you said, since I use U-Verse, am I supposed to
> >> > do
> >> > something as described here:
> >> > http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf
> >> >
> >> >
> >> >
> >> > I thought with PEAR, you don't need to do that anymore. Or, am I wrong?
> >> >
> >>
> >> Read the PEAR documentation:
> >> http://pear.php.net/manual/en/package.mail.mail.factory.php
> >> You can use other backends than just 'mail' - try using the smtp and
> >> fill in your smtp settings as needed.
> >>
> >> Regards
> >> Peter
> >>
> > I saw something like that on
> > http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm,
> > and this is probably what you are talking about?
> >
> >  $smtp = Mail::factory('smtp',
> >array ('host' => $host,
> >  'auth' => true,
> >  'username' => $username,
> >  'password' => $password));
> >
> > Do I still need to install a mail server? I have Evolution Mail on my Linux
> > box, and looks like that is a client and not a server.
> > Or, can I use any of the mail smtp setup, like Google? Or, do use some
> > authentication information from
> > http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, since I use
> > U-Verse at home?
> 
> Yes, the example you provide is the right direction - you can put in
> the smtp details you use to connect from Evolution to GMail, you don't
> need to setup a separate smtp server on your system.
> 
> Regards
> Peter
> 

Well, hold it. I have edited my code to hold the information as we have 
discussed earlier, and this is the error I have now:

Warning:  include_once(Net/SMTP.php) [function.include-once]: failed to open 
stream: No such file or directory in /usr/share/php/Mail/smtp.php on line 348



Warning:  include_once() [function.include]: Failed opening 'Net/SMTP.php' for 
inclusion (include_path='.:/usr/share/php') in /usr/share/php/Mail/smtp.php on 
line 348



Fatal error:  Class 'Net_SMTP' not found in /usr/share/php/Mail/smtp.php on 
line 349

I am not sure what this means. If I have installed pear correctly, what else do 
I have to do here? I can see that I have some "significant" error messages than 
not getting anything at all. 

Thanks for your help.

Alice
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

RE: [PHP] Mail Function Using PEAR Issues

2010-04-21 Thread Alice Wei


> Date: Thu, 22 Apr 2010 00:31:04 +0100
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> From: k...@linux.ie
> To: aj...@alumni.iu.edu
> CC: peter.e.l...@gmail.com; a...@ashleysheridan.co.uk; 
> php-general@lists.php.net
> 
> you have to install the net_smtp package, simply with this command:
> $ pear install net_smtp-1.4.2  (which will explicitly install version
> 1.4.2 of Net_SMTP)
> 
> If that doesn't work. for whatever reason, you could download the
> package manually from http://pear.php.net/package/Net_SMTP/download
> and install it by hand; though for reasons I've outlined in a previous
> post to this list I'd suggest you use the pear installer.
> 
> On Thu, Apr 22, 2010 at 12:12 AM, Alice Wei  wrote:
> >
> >> Date: Wed, 21 Apr 2010 22:01:03 +0200
> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >> To: aj...@alumni.iu.edu
> >> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> >>
> >> On 21 April 2010 21:58, Alice Wei  wrote:
> >> >> From: peter.e.l...@gmail.com
> >> >> Date: Wed, 21 Apr 2010 21:51:31 +0200
> >> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >> >> To: aj...@alumni.iu.edu
> >> >> CC: a...@ashleysheridan.co.uk; php-general@lists.php.net
> >> >>
> >> >> On 21 April 2010 18:44, Alice Wei  wrote:
> >> >> > I have mentioned several posts earlier that I have done nothing about 
> >> >> > my
> >> >> > php.ini file. From what you said, since I use U-Verse, am I supposed 
> >> >> > to
> >> >> > do
> >> >> > something as described here:
> >> >> > http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf
> >> >> >
> >> >> >
> >> >> >
> >> >> > I thought with PEAR, you don't need to do that anymore. Or, am I 
> >> >> > wrong?
> >> >> >
> >> >>
> >> >> Read the PEAR documentation:
> >> >> http://pear.php.net/manual/en/package.mail.mail.factory.php
> >> >> You can use other backends than just 'mail' - try using the smtp and
> >> >> fill in your smtp settings as needed.
> >> >>
> >> >> Regards
> >> >> Peter
> >> >>
> >> > I saw something like that on
> >> > http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm,
> >> > and this is probably what you are talking about?
> >> >
> >> >  $smtp = Mail::factory('smtp',
> >> >array ('host' => $host,
> >> >  'auth' => true,
> >> >  'username' => $username,
> >> >  'password' => $password));
> >> >
> >> > Do I still need to install a mail server? I have Evolution Mail on my 
> >> > Linux
> >> > box, and looks like that is a client and not a server.
> >> > Or, can I use any of the mail smtp setup, like Google? Or, do use some
> >> > authentication information from
> >> > http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, since I use
> >> > U-Verse at home?
> >>
> >> Yes, the example you provide is the right direction - you can put in
> >> the smtp details you use to connect from Evolution to GMail, you don't
> >> need to setup a separate smtp server on your system.
> >>
> >> Regards
> >> Peter
> >>
> >
> > Well, hold it. I have edited my code to hold the information as we have 
> > discussed earlier, and this is the error I have now:
> >
> > Warning:  include_once(Net/SMTP.php) [function.include-once]: failed to 
> > open stream: No such file or directory in /usr/share/php/Mail/smtp.php on 
> > line 348
> >
> >
> >
> > Warning:  include_once() [function.include]: Failed opening 'Net/SMTP.php' 
> > for inclusion (include_path='.:/usr/share/php') in 
> > /usr/share/php/Mail/smtp.php on line 348
> >
> >
> >
> > Fatal error:  Class 'Net_SMTP' not found in /usr/share/php/Mail/smtp.php on 
> > line 349
> >
> > I am not sure what this means. If I have installed pear correctly, what 
> > else do I have to do here? I can see that I have some "significant" error 
> > messages than not getting anything at all.
> >
> > Thanks for your help.
> >
> > Alice
> >
> > _
> > Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
> > http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
> 
> 
> 
> -- 
> http://blogs.linux.ie/kenguest/

As the time of writing this, I have installed the missing Net_SMTP pear package 
unto my Linux box. I have just tested it, and I have received two email 
messages to the desired mailbox, without having to install a mail server. 
Thanks for your help.

I really appreciate this. 

Alice
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

[PHP] Forward to a Different PHP Script?

2010-05-11 Thread Alice Wei

Hi, 

I am not sure if this makes sense, but here is a snippet of what I have:

$q=$_GET["q"];

//find out which feed was selected
if($q=="Herald Times")
  {
  $xml=("http://www.heraldtimesonline.com/rss/news.xml";);
  }
  else{
   
   //execute a whole different php program, like 
http://localhost/mypages/another_program.php
   exit;
  }

Is it possible that I could do something like this? If yes, what is the name of 
the function that I should use?
Thanks for your help.

Alice
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Forward to a Different PHP Script?

2010-05-11 Thread Alice Wei

> From: ak...@telkomsa.net
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: RE: [PHP] Forward to a Different PHP Script?
> Date: Tue, 11 May 2010 11:01:30 +0200
> 
> -Original Message-
> From: Alice Wei [mailto:aj...@alumni.iu.edu] 
> Sent: 11 May 2010 10:55 AM
> Subject: [PHP] Forward to a Different PHP Script?
> 
> Hi, 
> 
> I am not sure if this makes sense, but here is a snippet of what I have:
> 
> $q=$_GET["q"];
> 
> //find out which feed was selected
> if($q=="Herald Times")
>   {
>   $xml=("http://www.heraldtimesonline.com/rss/news.xml";);
>   }
>   else{
>
>//execute a whole different php program, like
> http://localhost/mypages/another_program.php
>exit;
>   }
> 
> Is it possible that I could do something like this? If yes, what is the name
> of the function that I should use?
> Thanks for your help.
> 
> Alice
> _
> 
> 
> Use include(mypages/another_program.php); 
> 
> Cheers
> Arno

Cool, it worked. Thanks!

> 
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

[PHP] Append Dom Document

2010-05-13 Thread Alice Wei

Hi, 

  I am trying to create a news feed page that loads a number of different feeds 
depending on what options the user selects. For some reason, I could not figure 
out how to get the dom document to "append" the different xml documents that 
get created. 

Below is the code, and obviously now every time when I try to have a new item 
selected, then it displays that element's 

http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss";);
break;
  
case "NFL":
  $xml = ("http://www.nfl.com/rss/rsslanding?searchString=home";);
  break;  
   
default:   
exit;
break;
   }
}

$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);

//get and output "" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=4; $i++)
  {
  $item_title=$x->item($i)->getElementsByTagName('title')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_link=$x->item($i)->getElementsByTagName('link')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_desc=$x->item($i)->getElementsByTagName('description')
  ->item(0)->childNodes->item(0)->nodeValue;

  echo ("" . $item_title . "");
  echo ("");
  echo ($item_desc . "");
  }

?> 
 

Is there such a function where I could allow my dom document here append and 
not have to create a new one every time when a new selection is made?

Thanks for your help.

Alice
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Append Dom Document

2010-05-13 Thread Alice Wei


Date: Thu, 13 May 2010 18:49:35 -0600
Subject: Re: [PHP] Append Dom Document
From: quickshif...@gmail.com
To: aj...@alumni.iu.edu
CC: php-general@lists.php.net



On Thu, May 13, 2010 at 5:46 PM, Alice Wei  wrote:



Hi,



  I am trying to create a news feed page that loads a number of different feeds 
depending on what options the user selects. For some reason, I could not figure 
out how to get the dom document to "append" the different xml documents that 
get created.




Below is the code, and obviously now every time when I try to have a new item 
selected, then it displays that element's



http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss";);


break;



case "NFL":

  $xml = ("http://www.nfl.com/rss/rsslanding?searchString=home";);

  break;



default:

exit;

break;

   }

}



$xmlDoc = new DOMDocument();

$xmlDoc->load($xml);



//get and output "" elements

$x=$xmlDoc->getElementsByTagName('item');

for ($i=0; $i<=4; $i++)

  {

  $item_title=$x->item($i)->getElementsByTagName('title')

  ->item(0)->childNodes->item(0)->nodeValue;

  $item_link=$x->item($i)->getElementsByTagName('link')

  ->item(0)->childNodes->item(0)->nodeValue;

  $item_desc=$x->item($i)->getElementsByTagName('description')

  ->item(0)->childNodes->item(0)->nodeValue;



  echo ("" . $item_title . "");

  echo ("");

  echo ($item_desc . "");

  }

you might have an easier time w/ SimpleXML for this task; have a look at the 
examples:
http://us.php.net/manual/en/simplexml.examples-basic.php

the other thing i find strange about this code is the xml parsing assumes a 
similar schema when the source urls are from seemingly totally disparate 
domains, and topic .. id guess it sheer coincidence they have overlapping 
schemas at all.

I am not sure what you mean in your second point, but I can explain the first 
one. I am using PHP to parse RSS feeds, so that is why they all look the same. 
Or, what do you mean here? I checked out your example, but my problem here is 
that I cannot get the XML Dom document to append when I make a new selection. I 
am hoping that it would create a new sub document of some sort beneath the new 
one, instead of overwriting the entire document. 

Am I making sense here?

Alice 
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Append Dom Document

2010-05-14 Thread Alice Wei

Hi, 

  You are right about the fact I am not having multiple documents, and yet what 
I am trying to do here is to have one xmldoc, which I have declared in my 
original email, and have my other rss feeds that I am trying to call from the 
PHP to append as I check more checkboxes from the list. 

  Right now, when I check one box, it does present it the way I want it, which 
is open a new xmldoc, and print out the rss feed. Yet, when I try to check the 
second box, it gives me the display of the rss feed from the second and not the 
first, because the second one opens a new xmldoc. However, I would like to see 
both docs in one screen, which is why I want to know if there is such a 
function available. 

  Is what I am trying to do here possibly by any chance?
  Thanks for your help.

Alice

Date: Fri, 14 May 2010 08:26:48 -0600
Subject: Re: [PHP] Append Dom Document
From: quickshif...@gmail.com
To: aball...@gmail.com
CC: aj...@alumni.iu.edu; php-general@lists.php.net

On Fri, May 14, 2010 at 7:20 AM, Andrew Ballard  wrote:

On Fri, May 14, 2010 at 12:04 AM, Nathan Nobbe  wrote:

[snip]

> having said that if you wanted to append

> a new DOMNode to an existing one, you would use the appendChild() method.



Usually, yes. In this case, since she would be importing nodes from

one document into another document, she would need to use importNode()

instead of appendChild().
right, if there was actually more than one document, which in this case there 
isnt...  whether or not there should be multiple DOMDocuments here is about as 
unclear as OPs original question.

-nathan   
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

[PHP] Dynamic Menus in a PHP Form Issue

2010-05-24 Thread Alice Wei

Hi,I have a snippet as in the following:
   Select the type of your starting point of interest: 

Apartment 
   If 
I tried to put this at the top of a file where I save as PHP with other PHP 
execution statements, looks like the form does not do anything, and yet when I 
save the page as in HTML with out the other PHP execution, it works. I am 
trying to create a page where I have dynamic drop down menu lists so users can 
egenerate dynamic content based on their preference. Is it possible that I can 
save the entire file as a PHP and still keep the functionality, including 
generating dynamic menus, writing the proper entries to the database and 
printing out the proper output?

Thanks for your help. 

Alice 
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Dynamic Menus in a PHP Form Issue

2010-05-25 Thread Alice Wei


> From: ak...@telkomsa.net
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> Subject: RE: [PHP] Dynamic Menus in a PHP Form Issue
> Date: Tue, 25 May 2010 08:59:08 +0200
> 
> -Original Message-
> From: Alice Wei [mailto:aj...@alumni.iu.edu] 
> Sent: 24 May 2010 04:47 PM
> To: php-general@lists.php.net
> Subject: [PHP] Dynamic Menus in a PHP Form Issue
> 
> Hi,I have a snippet as in the following:   
> Select the type of your starting point of interest:
> 
>  onclick="alert(document.form1.start)"/> Apartment 
> If I tried to put this at the top of a
> file where I save as PHP with other PHP execution statements, looks like the
> form does not do anything, and yet when I save the page as in HTML with out
> the other PHP execution, it works. I am trying to create a page where I have
> dynamic drop down menu lists so users can egenerate dynamic content based on
> their preference. Is it possible that I can save the entire file as a PHP
> and still keep the functionality, including generating dynamic menus,
> writing the proper entries to the database and printing out the proper
> output?
> 
> Thanks for your help. 
> 
> Alice   
> _
> 
> The reason it works in html is because it is "executed" in the browser. If
> you want this html to get to the browser you must either echo it to the
> output buffer that is sent to the browser, or end your php section with "?>"
> so that these lines are interpreted as part of the output that is sent to
> the browser.
> 
> If your php script is running without error then I presume you're already
> doing this. If that's the case then maybe it's not being put into the output
> buffer the way you're expecting (e.g. maybe the quotes don't match). You can
> look at the source code in the browser and compare it against the working
> html code to see where the difference is.
> 
> Cheers
> Arno

Thanks, guys. I have set now to 2 different requests, and it is doing great 
now. 

Alice
> 
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

[PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-25 Thread Alice Wei

Hi, 

  It is kind of difficult to explain what I am trying to do here, I will 
provide the form here to give a better idea. 

  
Select the type of your starting point of 
interest:

 Apartment 
 Grocery 
 Drug Store   
 

Select the type of your ending point of 
interest:

 Apartment 
 Grocery 
 Drug Store



   
Start Time: 
Arrive Time: 
Which Semster is this: 
Fall
Spring
Summer  
  




 
  
   
   

For some reason, when I pass in the output with process.php, the hidden input 
does not get passed in. Here is the process.php:

";
echo "End Time " . $end_time . "";
echo "Semester " . $semester . "";
echo "Start Location " . $form1 . "";
echo "End Location " . $form2 . "";

?>

I get values for start_time, end_time and semester, but not the last two 
values. What have I done wrong here?

Thanks for your help.

Alice

  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

Re: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-25 Thread Alice Wei

> Date: Tue, 25 May 2010 13:40:44 -0400
> Subject: Re: [PHP] 
Select Values Didn't Get Passed in From Two Different Forms
> 
From: marc.g...@gmail.com
> To: aj...@alumni.iu.edu
> 
>
 > I would like to take those values away into my third form, which 
is what you
> > see with the hidden. If they are not populated,
 then how come I could see
> > the drop down menus?
> 
>
 So you're expecting the values selected in the first two forms to
>
 populate the values of the hidden fields in the third form?  Why not
>
 wrap the whole thing in a single form?  Do test_getrss.php and
> 
test_getrss2.php perform anything useful or are they just hanging
>
 around?

No, the fields are populated in the first and second 
form, form1 and form2. What I want to do is to get the selections from 
both forms and pass them on to the third. Does this make sense? For some
 reason, the text input and the semester drop down menu result can be 
passed to process.php, but the results that I try to select from the 
first and second does not. So, the form is not passing the results of 
what I had from the radio button selections.

To illustrate, the 
second looks something like this:

echo "";
while($nt=mysql_fetch_array($result)){//Array
 or records stored in $nt
echo "$nt[0]";
}
echo "";

How
 can I pass the values of what I picked in end_location here to 
process.php?

Thanks for your help.

Alice

  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-25 Thread Alice Wei


Subject: Re: [PHP] Select Values Didn't Get Passed in From Two Different Forms
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: php-general@lists.php.net
Date: Tue, 25 May 2010 20:37:29 +0100






  
  


On Tue, 2010-05-25 at 15:41 -0400, Alice Wei wrote:

> Date: Tue, 25 May 2010 13:40:44 -0400
> Subject: Re: [PHP] 
Select Values Didn't Get Passed in From Two Different Forms
> 
From: marc.g...@gmail.com
> To: aj...@alumni.iu.edu
> 
>
 > I would like to take those values away into my third form, which 
is what you
> > see with the hidden. If they are not populated,
 then how come I could see
> > the drop down menus?
> 
>
 So you're expecting the values selected in the first two forms to
>
 populate the values of the hidden fields in the third form?  Why not
>
 wrap the whole thing in a single form?  Do test_getrss.php and
> 
test_getrss2.php perform anything useful or are they just hanging
>
 around?

No, the fields are populated in the first and second 
form, form1 and form2. What I want to do is to get the selections from 
both forms and pass them on to the third. Does this make sense? For some
 reason, the text input and the semester drop down menu result can be 
passed to process.php, but the results that I try to select from the 
first and second does not. So, the form is not passing the results of 
what I had from the radio button selections.

To illustrate, the 
second looks something like this:

echo "";
while($nt=mysql_fetch_array($result)){//Array
 or records stored in $nt
echo "$nt[0]";
}
echo "";

How
 can I pass the values of what I picked in end_location here to 
process.php?

Thanks for your help.

Alice

  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5





You can only pass results from both forms if you duplicate the results of one 
in the other and then submit that one. You can't submit two forms at the same 
time. Why do they have to be two forms anyway?


Well, two of them are created with Ajax that are passed through PHP, so you 
select one drop down menu are a time, as the drop down menu comes from what you 
select from a radio button. The results are dynamically. so I don't think they 
are even created at the same time. Does this help in explaining what I am 
trying to accomplish?

Thanks.





Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-26 Thread Alice Wei

On Tue, 2010-05-25 at 15:41 -0400, Alice Wei wrote:

> Date: Tue, 25 May 2010 13:40:44 -0400
> Subject: Re: [PHP] 
Select Values Didn't Get Passed in From Two Different Forms
> 
From: marc.g...@gmail.com
> To: aj...@alumni.iu.edu
> 
>
 > I would like to take those values away into my third form, which 
is what you
> > see with the hidden. If they are not populated,
 then how come I could see
> > the drop down menus?
> 
>
 So you're expecting the values selected in the first two forms to
>
 populate the values of the hidden fields in the third form?  Why not
>
 wrap the whole thing in a single form?  Do test_getrss.php and
> 
test_getrss2.php perform anything useful or are they just hanging
>
 around?

No, the fields are populated in the first and second 
form, form1 and form2. What I want to do is to get the selections from 
both forms and pass them on to the third. Does this make sense? For some
 reason, the text input and the semester drop down menu result can be 
passed to process.php, but the results that I try to select from the 
first and second does not. So, the form is not passing the results of 
what I had from the radio button selections.

To illustrate, the 
second looks something like this:

echo "";
while($nt=mysql_fetch_array($result)){//Array
 or records stored in $nt
echo "$nt[0]";
}
echo "";

How
 can I pass the values of what I picked in end_location here to 
process.php?

Thanks for your help.

Alice

  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5





You can only pass results from both forms if you duplicate the results of one 
in the other and then submit that one. You can't submit two forms at the same 
time. Why do they have to be two forms anyway?


Well, two of them are created with Ajax that are passed through PHP, so you 
select one drop down menu are a time, as the drop down menu comes from what you 
select from a radio button. The results are dynamically. so I don't think they 
are even created at the same time. Does this help in explaining what I am 
trying to accomplish?

Thanks.





Thanks,

Ash

http://www.ashleysheridan.co.uk




You should get the Ajax to modify the first form. It's a lot easier than 
creating a second form that uses more Ajax to duplicate any selected values 
from the first. Have a look at the JQuery library, it makes a lot of the 
Javascript end a lot easier.

  I know this is not a PHP question, but could you direct me to something more 
specific on what I should do here? I am really new to Ajax. 






Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-26 Thread Alice Wei


> Date: Wed, 26 May 2010 09:19:26 -0400
> To: php-general@lists.php.net; aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
> Forms
> 
> At 9:17 PM -0400 5/25/10, Alice Wei wrote:
> >No, the fields are populated in the first and second
> >form, form1 and form2. What I want to do is to get the selections from
> >both forms and pass them on to the third. Does this make sense? For some
> >  reason, the text input and the semester drop down menu result can be
> >passed to process.php, but the results that I try to select from the
> >first and second does not. So, the form is not passing the results of
> >what I had from the radio button selections.
> >
> >To illustrate, the
> >second looks something like this:
> 
> Alice:
> 
> No offense, but "Looking" like something isn't going to cut it.
> 
> I advise you to:
> 
> 1. Show us the code. -- give us a url where your code is located.
> 
> 2. Tell us what you *want* to do -- and don't show us with "it looks 
> something like this" nonsense.
> 
> 3. Get the simple stuff to work first before jumping into the harder stuff.
> 
> If you are willing to do the above, then I'll help you with your problem.
> 
> Please understand that forms are very simple with very simple rules 
> to follow. Enhancing forms with javascript routines can become 
> complicated very quickly. But if you can describe it, it can be done.
> 
> Cheers,
> 
> tedd
> 
> 


I thought I provided the whole code, but looks like it somehow got lost in the 
thread. 

Here is the main file I would like to use for my data entry:

Main:


 

Select the type of your starting point of interest:

 Apartment 
 Grocery  
   
 

  
  

   


 



This is the script that I use to construct the drop down menu in test_getrss.php

";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "$nt[0]";
/* Option values are added by looping through the array */
}
echo "";// Closing of list box 
?> 


See, I am trying to get the users pick something from the  and have the info in there to pass on to process.php

";





?>

Therefore, the radio button info. does not need to be recorded. This is not the 
only field I need to pass to process.php, which the data would be used to enter 
into a database. I am leaving what is not working in my code. I hope this helps 
in understanding what my problem may be. 

Thanks for your help. 

Alice
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-26 Thread Alice Wei


> Date: Wed, 26 May 2010 15:36:18 -0400
> To: php-general@lists.php.net; aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
> 
> Alice:
> 
> You provide:
> 
> > 
> > 
> > Select the type of your starting point of interest:
> >  >action="test_getrss.php" name="form1" method="post">
> >  >value="Apartment" name="start"
> > 
> >onclick="check(document.form1.start)"/> Apartment 
> >  >value="Grocery" name="start"
> > 
> >onclick="check(document.form1.start)"/> Grocery 
> > 
> >   
> >
> > 
> > 
> >  >value=""/>
> > 
> > 
> > 
> > 
> >
> >
> 


   My bad, I cannot imagine I sent that stuff. To answer your question, here it 
is, 

 



Select the type of your starting point of interest:
 

   
   

 

This is what is working now if I do it this way, but again, then I got to make 
sure everything is "typed up properly" before the form is submitted. Does this 
answer your questions by any chance?

 

Thanks for your help.

 

Alice

 

> 
> You also state:
> 
> > I hope this helps in understanding what my problem may be.
> 
> It's very apparent that your problem is multifold and to solve it we 
> need to take the "solution" in steps.
> 
> First, the above HTML code is just plain horrible -- and that's just 
> html part or the problem -- let alone the more complicated 
> php/mysql/javascript coding.
> 
> If that is the best html code you can write, then I suggest that you 
> go back to learn html before learning anything else.
> 
> So, your assignment (if you want me to continue to help) is to create 
> a simple form to collect the data you want. Nothing fancy, just a 
> simple form -- can you do that?
> 
> The assignment is in your court. If you can show you can do that, 
> then we'll proceed to the next step.
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com http://ancientstones.com http://earthstones.com

  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-27 Thread Alice Wei

  
> Date: Thu, 27 May 2010 12:23:46 -0400
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
> 
> At 3:50 PM -0400 5/26/10, Alice Wei wrote:
> >
> > My bad, I cannot imagine I sent that stuff. To answer your 
> >question, here it is,
> >
> > 
> > Select the type of your starting point of interest:
> >  >maxlength="50"/>
> >
> > 
> > 
> >
> >
> >This is what is working now if I do it this way, but again, then I 
> >got to make sure everything is "typed up properly" before the form 
> >is submitted. Does this answer your questions by any chance?
> >
> >
> >Alice
> >
> 
> Alice:
> 
> Okay, not bad -- here's my addition:
> 
> http://www.webbytedd.com//alice/
> 
> Please review the code. I removed the maxlength because that's 
> something you should do server-side anyway. Never trust anything 
> coming from the client-side.
> 
> Also note that closing the tags, such as  is optional -- IF -- 
> you're not planning on using XML. Otherwise they will generate a W3C 
> short-tags warning. However, that's not a fatal error.
> 
> Also note the Submit button statement has three attributes. Type 
> states the type of input statement, value is what the button displays 
> to the user (i.e., Submit") and name is the name of the variable that 
> you can access via a POST/GET.
> 
> Also note how the form collects the "start" value from a POST and 
> then repopulates the form after it has the data. This important to 
> understand. Clicking the "Submit" button sends the form's data to the 
> server which then sends it back to the browser via a refreshed form.
> 
> Also note the ternary operator I used, namely:
> 
> $start = isset($_POST['start']) ? $_POST['start'] : null;
> 
> The first time the page is viewed, POST is sampled for content. If 
> there is no content, then checking for content will generate an error 
> unless we first check to see if it has content, hence the isset(). If 
> it doesn't have content, then the statement assigns NULL to $start. 
> If it does have content, then it will assign that value to $start, 
> understand?
> 
> Now, what's next? What other data do you want to collect? You 
> mentioned a select control that derived its data from a database. But 
> before we go to that, show me a "select" control working in a form 
> with embedded values -- in other words, just a simple select control. 
> Please add it to the form we have.
> 
> Cheers,
> 
> 
> tedd
> 
 
I am not sure how to add to the page you have set up, but here is the code with 
ther portion you have set up:
 



  
Select the type of your starting point of interest:

Which Semster is this: 
Fall
Spring
Summer


  


 Note, what I provided here does not include anything on the ajax. 

 

Hope this answers your question. 

 

Alice

> -- 
> ---
> http://sperling.com http://ancientstones.com http://earthstones.com


  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


 Date: Fri, 28 May 2010 12:34:55 -0400
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
> Forms
> 
> At 9:19 PM -0400 5/27/10, Alice Wei wrote:
> >
> >I am not sure how to add to the page you have set up, but here is 
> >the code with ther portion you have set up:
> >
> >
> > >   $start = isset($_POST['start']) ? $_POST['start'] : null;
> >?>
> > 
> >   
> > Select the type of your starting point of interest:
> > 
> > Which Semster is this: 
> > Fall
> > Spring
> > Summer
> > 
> > 
> >   
> > 
> >
> >  Note, what I provided here does not include anything on the ajax.
> >
> >Hope this answers your question.
> 
> Alice :
> 
> I didn't have a question, but here's my revision of your code:
> 
> http://www.webbytedd.com//alice1/
> 
> Please review the code and see how: 1) I captured the select value; 
> 2) and how I used that value to focus the selected option.
> 
> You say:
> 
> >  Note, what I provided here does not include anything on the ajax.
> 
> I've never put anything "on the ajax" -- that doesn't make sense.
> 
> Ajax is simply a way to communicate from the browser to the server 
> and back again without requiring a browser refresh. As the user 
> triggers a client-side event (i.e., click, select, enter text, move a 
> mouse, whatever), a javascript routine then sends data to the server 
> to activate a server-side script, which may, or may not, return data.
> 
> For example -- with javascript turned ON please review:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> This is simply a one page template that uses an ajax routine to 
> retrieve data from the server to populate the page based upon what 
> the user triggers (i.e., the visitor clicks a navigational link).
> 
> If you will review the HTML source code, you will find a very basic 
> HTML template that will remain static for all three "apparent" pages. 
> If you use the FireFox browser you can review the generated HTML.
> 
> Now where did the generated HTML come from, you might ask? It came 
> from the server after a request was made from the client to the 
> server and the server responded with the correct data -- all without 
> requiring a browser refresh. That's an example of how ajax works.
> 
> Keep in mind that using "best practices" requires you to *first* 
> design forms to collect data WITHOUT requiring javascript and then 
> you can enhance the form to provide additional functionality to those 
> who have javascript turned on. Also keep in mind that you may not 
> need ajax to alter the form. You only need ajax if there is data on 
> the server that needs to be retrieved.
> 
> Now, please turn javascript OFF in your browser and review my page again:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> That's an example of NOT following "best practices". The visitor is 
> provided nothing if they have javascript turned OFF.
> 
> Now considering such, what additional functionality do you want your 
> form to do that can't be done already?
> 
> Cheers,
> 
> tedd
> 
> -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which "select menu" to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei

Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: tedd.sperl...@gmail.com; php-general@lists.php.net
Date: Fri, 28 May 2010 20:05:29 +0100






  
  


On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote:


 Date: Fri, 28 May 2010 12:34:55 -0400
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
> Forms
> 
> At 9:19 PM -0400 5/27/10, Alice Wei wrote:
> >
> >I am not sure how to add to the page you have set up, but here is 
> >the code with ther portion you have set up:
> >
> >
> > >   $start = isset($_POST['start']) ? $_POST['start'] : null;
> >?>
> > 
> >   
> > Select the type of your starting point of interest:
> > 
> > Which Semster is this: 
> > Fall
> > Spring
> > Summer
> > 
> > 
> >   
> > 
> >
> >  Note, what I provided here does not include anything on the ajax.
> >
> >Hope this answers your question.
> 
> Alice :
> 
> I didn't have a question, but here's my revision of your code:
> 
> http://www.webbytedd.com//alice1/
> 
> Please review the code and see how: 1) I captured the select value; 
> 2) and how I used that value to focus the selected option.
> 
> You say:
> 
> >  Note, what I provided here does not include anything on the ajax.
> 
> I've never put anything "on the ajax" -- that doesn't make sense.
> 
> Ajax is simply a way to communicate from the browser to the server 
> and back again without requiring a browser refresh. As the user 
> triggers a client-side event (i.e., click, select, enter text, move a 
> mouse, whatever), a javascript routine then sends data to the server 
> to activate a server-side script, which may, or may not, return data.
> 
> For example -- with javascript turned ON please review:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> This is simply a one page template that uses an ajax routine to 
> retrieve data from the server to populate the page based upon what 
> the user triggers (i.e., the visitor clicks a navigational link).
> 
> If you will review the HTML source code, you will find a very basic 
> HTML template that will remain static for all three "apparent" pages. 
> If you use the FireFox browser you can review the generated HTML.
> 
> Now where did the generated HTML come from, you might ask? It came 
> from the server after a request was made from the client to the 
> server and the server responded with the correct data -- all without 
> requiring a browser refresh. That's an example of how ajax works.
> 
> Keep in mind that using "best practices" requires you to *first* 
> design forms to collect data WITHOUT requiring javascript and then 
> you can enhance the form to provide additional functionality to those 
> who have javascript turned on. Also keep in mind that you may not 
> need ajax to alter the form. You only need ajax if there is data on 
> the server that needs to be retrieved.
> 
> Now, please turn javascript OFF in your browser and review my page again:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> That's an example of NOT following "best practices". The visitor is 
> provided nothing if they have javascript turned OFF.
> 
> Now considering such, what additional functionality do you want your 
> form to do that can't be done already?
> 
> Cheers,
> 
> tedd
> 
> -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which "select menu" to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: tedd.sperl...@gmail.com; php-general@lists.php.net
Date: Fri, 28 May 2010 20:14:06 +0100






  
  


On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:


Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
Forms

From: a...@ashleysheridan.co.uk

To: aj...@alumni.iu.edu

CC: tedd.sperl...@gmail.com; php-general@lists.php.net

Date: Fri, 28 May 2010 20:05:29 +0100



On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote: 


 Date: Fri, 28 May 2010 12:34:55 -0400
> To: aj...@alumni.iu.edu; php-general@lists.php.net
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
> Forms
> 
> At 9:19 PM -0400 5/27/10, Alice Wei wrote:
> >
> >I am not sure how to add to the page you have set up, but here is 
> >the code with ther portion you have set up:
> >
> >
> > >   $start = isset($_POST['start']) ? $_POST['start'] : null;
> >?>
> > 
> >   
> > Select the type of your starting point of interest:
> > 
> > Which Semster is this: 
> > Fall
> > Spring
> > Summer
> > 
> > 
> >   
> > 
> >
> >  Note, what I provided here does not include anything on the ajax.
> >
> >Hope this answers your question.
> 
> Alice :
> 
> I didn't have a question, but here's my revision of your code:
> 
> http://www.webbytedd.com//alice1/
> 
> Please review the code and see how: 1) I captured the select value; 
> 2) and how I used that value to focus the selected option.
> 
> You say:
> 
> >  Note, what I provided here does not include anything on the ajax.
> 
> I've never put anything "on the ajax" -- that doesn't make sense.
> 
> Ajax is simply a way to communicate from the browser to the server 
> and back again without requiring a browser refresh. As the user 
> triggers a client-side event (i.e., click, select, enter text, move a 
> mouse, whatever), a javascript routine then sends data to the server 
> to activate a server-side script, which may, or may not, return data.
> 
> For example -- with javascript turned ON please review:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> This is simply a one page template that uses an ajax routine to 
> retrieve data from the server to populate the page based upon what 
> the user triggers (i.e., the visitor clicks a navigational link).
> 
> If you will review the HTML source code, you will find a very basic 
> HTML template that will remain static for all three "apparent" pages. 
> If you use the FireFox browser you can review the generated HTML.
> 
> Now where did the generated HTML come from, you might ask? It came 
> from the server after a request was made from the client to the 
> server and the server responded with the correct data -- all without 
> requiring a browser refresh. That's an example of how ajax works.
> 
> Keep in mind that using "best practices" requires you to *first* 
> design forms to collect data WITHOUT requiring javascript and then 
> you can enhance the form to provide additional functionality to those 
> who have javascript turned on. Also keep in mind that you may not 
> need ajax to alter the form. You only need ajax if there is data on 
> the server that needs to be retrieved.
> 
> Now, please turn javascript OFF in your browser and review my page again:
> 
> http://www.webbytedd.com/a/ajax-site/
> 
> That's an example of NOT following "best practices". The visitor is 
> provided nothing if they have javascript turned OFF.
> 
> Now considering such, what additional functionality do you want your 
> form to do that can't be done already?
> 
> Cheers,
> 
> tedd
> 
> -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which "select menu" to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
> ---
> http://sperling.com  http://ancientstones.com  http:

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


> Date: Fri, 28 May 2010 17:18:21 -0400
> To: aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
> Forms
> CC: php-general@lists.php.net
> 
> >On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
> >   What I am trying to find out is, when I have my form with a 
> >dependent select menu, how can I pass the value of the select menu 
> >to another page? I have mentioned in the initial email that if I 
> >just allow users to type stuff, it passes the form back to itself 
> >and works. However, what I want
> >  to do is to allow users click one radio button/checkbox, and use 
> >that value to determine which "select menu" to bring up. However, 
> >the information I am only interested in storing, is the value of the 
> >select menu and not the radio  button/checkbox.
> >
> >Am I making sense here?
> 
> and
> 
> >>Maybe that is why I cannot pass the information on in the "hidden" 
> >>value, but what have I missed here? Ajax? PHP? I am getting 
> >>confused.
> >>
> >>Alice
> 
> Alice:
> 
> That's the reason why I am taking this in steps instead of hitting 
> you with all the buzz-words you were throwing around when we started.
> 
> If you don't know how to pass variables from one page to another, 
> then why require ajax? That only complicates the process. There are 
> several methods to pass variables from one page to another. You could 
> have everything contained in a single page, but let's just solve your 
> problem.
> 
> To pass things from one page to another has been demonstrated to you 
> in the examples I provided, namely:
> 
> http://webbytedd.com//alice
> 
> and
> 
> http://webbytedd.com//alice1/ 
> 
> Those forms are passing data as the user clicks submit.
> 
> Now, you want the user to pick a value and then pass that value to a 
> different page to bring up a different select control, right?
> 
> Please review this:
> 
> http://www.webbytedd.com//alice2/index.php
> 
> That does everything you ask and it does it simply without ajax. From 
> these examples you should be able to create just about anything you 
> want.
> 
> Cheers,
> 
> tedd
> 
Anything I want? 

Seriously, I do know how to pass a "non-dynamic" element from one page to 
another page, but when I started researching on how to utilize dynamic menus 
based on user input, I found Ajax, until this problem that I am running into 
hits me. 

Is there some way that I could generate dynamic select menus without 
using Ajax? Or, is that asking too much?

Thanks for your help.

Alice


> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


From: aj...@alumni.iu.edu
To: tedd.sperl...@gmail.com
CC: php-general@lists.php.net
Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  Forms
Date: Fri, 28 May 2010 19:31:10 -0400









> Date: Fri, 28 May 2010 17:18:21 -0400
> To: aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
> Forms
> CC: php-general@lists.php.net
> 
> >On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
> >   What I am trying to find out is, when I have my form with a 
> >dependent select menu, how can I pass the value of the select menu 
> >to another page? I have mentioned in the initial email that if I 
> >just allow users to type stuff, it passes the form back to itself 
> >and works. However, what I want
> >  to do is to allow users click one radio button/checkbox, and use 
> >that value to determine which "select menu" to bring up. However, 
> >the information I am only interested in storing, is the value of the 
> >select menu and not the radio  button/checkbox.
> >
> >Am I making sense here?
> 
> and
> 
> >>Maybe that is why I cannot pass the information on in the "hidden" 
> >>value, but what have I missed here? Ajax? PHP? I am getting 
> >>confused.
> >>
> >>Alice
> 
> Alice:
> 
> That's the reason why I am taking this in steps instead of hitting 
> you with all the buzz-words you were throwing around when we started.
> 
> If you don't know how to pass variables from one page to another, 
> then why require ajax? That only complicates the process. There are 
> several methods to pass variables from one page to another. You could 
> have everything contained in a single page, but let's just solve your 
> problem.
> 
> To pass things from one page to another has been demonstrated to you 
> in the examples I provided, namely:
> 
> http://webbytedd.com//alice
> 
> and
> 
> http://webbytedd.com//alice1/ 
> 
> Those forms are passing data as the user clicks submit.
> 
> Now, you want the user to pick a value and then pass that value to a 
> different page to bring up a different select control, right?
> 
> Please review this:
> 
> http://www.webbytedd.com//alice2/index.php
> 
> That does everything you ask and it does it simply without ajax. From 
> these examples you should be able to create just about anything you 
> want.
> 
> Cheers,
> 
> tedd
> 
Anything I want? 

On a second note, after looking at your example again, is it possible to 
generate what is on form 4 without having to push submit button on form 3? Or, 
is that another topic in Javascript or something else?

Alice


> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get 
started.   
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-29 Thread Alice Wei


> Date: Sat, 29 May 2010 11:50:50 -0400
> To: php-general@lists.php.net; aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different   
> Forms
> 
> At 7:31 PM -0400 5/28/10, Alice Wei wrote:
> >
> >Anything I want?
> >
> >Seriously, I do know how to pass a "non-dynamic" element from one 
> >page to another page, but when I started researching on how to 
> >utilize dynamic menus based on user input, I found Ajax, until this 
> >problem that I am running into hits me.
> >
> >Is there some way that I could generate dynamic select menus without 
> >using Ajax? Or, is that asking too much?
> >
> >Thanks for your help.
> >
> >Alice
> 
> Alice:
> 
> No offense, but considering what you posted when you started this 
> exchange, it did not appear that you knew how to use forms. But on 
> the other hand, I don't know what "non-dynamic" elements are.
> 
> Now on to your problem -- you want to "generate dynamic select menu" 
> -- I'm not sure what those are either. I think you need to start 
> using the terminology used in html, controls, and such. You can't 
> just throw terms together hoping that the person at the other end 
> knows what you're talking about.
> 
> In any event, here's something for you to consider:
> 
> http://www.webbytedd.com/a/ajax-controls/
> 
> It shows how to use javascript to detect user's actions in input 
> elements (i.e., text, radio, checkboxes, etc.) and select elements. 
>  From those routines, you should be able to construct whatever 
> "dynamic select menus" you want. All the code is there -- just review 
> it.
> 
> It would be a trivial matter to add a Submit button to the form to 
> pass these values to the server via traditional means and thus the 
> Submit was omitted to show how Ajax Controls work.
> 
> However, it is important to note that the example provided above is 
> not unobtrusive -- it is an early example of how all of this was 
> done. There are more appropriate ways to accomplish this, but they 
> require more abstraction, which would probably lead to more confusion 
> on your part -- no offense meant.
> 
> I suggest you read "DOM Scripting" and "Advance DOM Scripting" both 
> published by Friends of ED. They are well worth the cost/effort to 
> read and would give you a better understanding of the processes 
> involved.
> 
> Cheers,
> 
> tedd
> 


At the time of writing this, I got all the functionality I wanted, only that it 
takes 3 submits, which is 4 pages in total, which includes two dependent select 
menus based on user input by clicking on the radio button and some other static 
drop downs and text inputs. 

I am not sure if it is possible to cut it down two only two submits, I just 
went online and found this, 
http://www.w3schools.com/dhtml/tryit.asp?filename=trydhtml_event_onchange. If I 
could change this function to using the radio button, and process the other 
searching for the dependent drop downs using case statements with PHP , do you 
think this is a good idea?

Anyway, I found this method is kind of ugly for the time being, but less 
daunting with what I was doing before. Thanks. 

Alice


> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-30 Thread Alice Wei

> Date: Sun, 30 May 2010 11:53:44 -0400
> To: php-general@lists.php.net; aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different
> Forms
> 
> At 12:08 PM -0400 5/29/10, Alice Wei wrote:
> >
> >At the time of writing this, I got all the functionality I wanted, 
> >only that it takes 3 submits, which is 4 pages in total, which 
> >includes two dependent select menus based on user input by clicking 
> >on the radio button and some other static drop downs and text inputs.
> >
> >I am not sure if it is possible to cut it down two only two submits, 
> >I just went online and found this, 
> >http://www.w3schools.com/dhtml/tryit.asp?filename=trydhtml_event_onchange. 
> >If I could change this function to using the radio button, and 
> >process the other searching for the dependent drop downs using case 
> >statements with PHP , do you think this is a good idea?
> >
> >Anyway, I found this method is kind of ugly for the time being, but 
> >less daunting with what I was doing before. Thanks.
> >
> >Alice
> 
> Alice:
> 
> The example you provided above is very basic and I think what you 
> want is far more complex.
> 
> I realize that it's hard to convey what it is that you actually want 
> because you don't know all that can be done -- and the number of 
> possibilities of how to organize controls is far too vast for me to 
> guess.
> 
> For example, here's another example of what can be done:
> 
> http://www.webbytedd.com/a/ajax-select/index.php
> 
> But I know this doesn't fully solve your problem but it comes closer 
> than the example you provided above.
> 
> Sometimes it's best to "story-board" what you want so that both you 
> and to whom you're asking questions can have a better idea of the 
> problem.
> 
> For example, let's say you want to gather data from a user -- in 
> option A, the user is asked Y/N. If the user answers N, then the user 
> is sent to option B. If the user answers Y, then the user is sent to 
> option C. In option B the user is presented with... and Option C the 
> user is presented with... and so on. -- I'm sure you get the idea.
> 
> So, if you want to continue with this, please prepare a "story-board" 
> and present your problem again.
> 
> Cheers,
> 
> tedd
> 
> -- 

Tedd, 

  Looks like I finally found the answer to my question, and the key is the 
term, dependent drop down menu. There is an example that I found here, 
http://www.huanix.com/files/dependent_select/dependent_select.txt, and after 
editing everything, looks like what I want is not so far to reach. As I am 
writing now, I got the code I desired to work after studying what went on in 
the code from the above link. 

Thanks for your help, and looks like I solved the problem, I may be able to 
close the thread now. 

Alice

> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-31 Thread Alice Wei


> Date: Mon, 31 May 2010 11:56:38 -0400
> To: php-general@lists.php.net; aj...@alumni.iu.edu
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
> Forms
> 
> At 7:23 PM -0400 5/30/10, Alice Wei wrote:
> >Tedd,
> >
> >   Looks like I finally found the answer to my question, and the key 
> >is the term, dependent drop down menu. There is an example that I 
> >found here, 
> >http://www.huanix.com/files/dependent_select/dependent_select.txt, 
> >and after editing everything, looks like what I want is not so far 
> >to reach. As I am writing now, I got the code I desired to work 
> >after studying what went on in the code from the above link.
> >
> >Thanks for your help, and looks like I solved the problem, I may be 
> >able to close the thread now.
> >
> >Alice
> 
> 
> Alice:
> 
> An interesting solution.
> 
> I tested it here:
> 
> http://php1.net/a/ajax-select-db
> 
> The database needs a little work -- I wasn't aware that Virginia was 
> a State in Germany. :-)
> 
> It also needs a little work when someone changes an intermediate 
> selection to null the ones further down the chain -- it only goes one 
> deep.
> 
> The control also uses GET when I think POST would work better -- at 
> least it would hide the inner-workings of the control from the user.
> 
> However, if that was what you were looking for then great.
   
About the get and post, yes, I did change that to post in my sample, but thanks 
for pointing it out. 

Alice

> 
> Good luck and thread closed.
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

[PHP] Preg Match Problem

2010-06-02 Thread Alice Wei

Hi, 

I have a code snippet here as in the following:

[CODE]
$keywords = preg_split("/[\s,]+/", $day);
$count = count($keywords);
  if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) { //line 40
   $day_query ="start_time.day='12345' AND end_time.day='12345'";  
   }  
   if(preg_match("Sat/i", $keywords[$i])) { //line 43
   $day_query = "start_time.Sat_route != 'NULL' AND end_time.Sat_route != 
'NULL'";
   }  
   else {
   echo $keywords[i] . " is not a term that exists in the database. Make sure 
the pattern looks like Mon, Tue";
   footer();
   exit;
   }
[/CODE]

For some reason, when I type in Mon, Tue

It gives me this: 

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in line 40
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric 
or backslash on line 43
is not a term that exists in the database. Make sure the pattern looks like 
Mon, Tue

Have I done something wrong here?
Thanks for your help.
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

RE: [PHP] Preg Match Problem

2010-06-02 Thread Alice Wei


> From: peter.e.l...@gmail.com
> Date: Wed, 2 Jun 2010 18:17:00 +0200
> Subject: Re: [PHP] Preg Match Problem
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> On 2 June 2010 18:14, Alice Wei  wrote:
> >
> > Hi,
> >
> > I have a code snippet here as in the following:
> >
> > [CODE]
> > $keywords = preg_split("/[\s,]+/", $day);
> > $count = count($keywords);
> >  if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) { //line 40
> 
> You're lacking the starting delimiter '/'
> 
> Regards
> Peter
> 

Thanks, that did the trick. 

Alice

> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

[PHP] Modifying Existing Text File From PHP Is Not Working

2010-06-27 Thread Alice Wei

Hi, 

I have the code as in the following:

\n" . $name . "\n" . $phone . 
"\n". 
  $email . "\n" .  $comments . 
"\n";

//If file exists. append, otherwise create
$file = "messages.xml";
$fh = fopen($file,"a");
$lines = file($file);

//Output a line of the file until the end is reached
foreach($lines as $line) {

   if (trim($line) == "") {

$line = "" . $string; // If string, change it.
echo $line . "";
fwrite($fh, $line);
   
   } 
   else {
   
// If not don't write anything
   echo $line . "";

   }
  fclose($file); // Close the file.
  }
?>

For some reason, it is writing out the lines, but it is not f-writing to the 
file. Here is the file that is meant to be edited:



Me
123-456-7890
t...@test.com
This is my message board!



Have I missed something here? How come the file cannot perform fwrite actions?

Thanks for your help.
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: [PHP] Modifying Existing Text File From PHP Is Not Working

2010-06-27 Thread Alice Wei

> Subject: Re: [PHP] Modifying Existing Text File From PHP Is Not Working
> From: lexsi...@gmail.com
> Date: Sun, 27 Jun 2010 13:47:53 +0200
> To: aj...@alumni.iu.edu
> 
> You are closing your file too early. Close it outside the foreach.
> An other point : you should not 'edit' an XML file by this way ; use an XML 
> api like dom or simplexml
> 
> Regards
> 
> --
> Alexandre Simon
> http://alex.zybar.net
> 

Hi, 

  I did try changing the fclose to after all the brackets in my php file. On 
another note, I checked the permission of my folder that I was attempting to 
write in, which all users have write, modify, read and execute permissions. I 
don't see any 500 or permission denied errors, and I use IIS, so I don't use 
apache. 

  It didn't work though, the suggestion you provided on simpleXML looks 
promising, and yet I am writing not to the child, and plus I seem to be getting 
a 500 error. Another thing is, do I need to "save" the file after all this 
echoing is done using simpleXML? 

BTW, here is the code, which I am sure that I must have done something wrong 
here. Could anyone please help me out here?

Thanks for your help. 
Is it possible that I could do it the way I did it before by any chance?

 messages[0]->addChild("message", "");
$xml -> message[0]->addChild("name",$name);
$xml -> message[0] ->addChild("phone",$phone);
$xml -> message[0] -> addChild("email",$email);
$xml-> message[0] -> addChild("comments",$comments);

echo $xml->asXML();

?>

Alice

> Le 27 juin 2010 à 13:20, Alice Wei  a écrit :
> 
> > 
> > Hi, 
> > 
> > I have the code as in the following:
> > 
> >  > 
> > $name= "Test";
> > $phone= "123-456-7890";
> > $email = "myem...@mymail.com";
> > $comments = "Test Only";
> > 
> > $string = "\n" . $name . "\n" . $phone . 
> > "\n". 
> >  $email . "\n" .  $comments . 
> > "\n";
> > 
> > //If file exists. append, otherwise create
> > $file = "messages.xml";
> > $fh = fopen($file,"a");
> > $lines = file($file);
> > 
> > //Output a line of the file until the end is reached
> > foreach($lines as $line) {
> > 
> >   if (trim($line) == "") {
> > 
> >$line = "" . $string; // If string, change it.
> >echo $line . "";
> >fwrite($fh, $line);
> > 
> >   } 
> >   else {
> > 
> >// If not don't write anything
> >   echo $line . "";
> > 
> >   }
> >  fclose($file); // Close the file.
> >  }
> > ?>
> > 
> > For some reason, it is writing out the lines, but it is not f-writing to 
> > the file. Here is the file that is meant to be edited:
> > 
> > 
> > 
> > Me
> > 123-456-7890
> > t...@test.com
> > This is my message board!
> > 
> > 
> > 
> > Have I missed something here? How come the file cannot perform fwrite 
> > actions?
> > 
> > Thanks for your help.
> > 
> > _
> > The New Busy is not the too busy. Combine all your e-mail accounts with 
> > Hotmail.
> > http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

  1   2   >