php-general Digest 28 Mar 2001 07:16:28 -0000 Issue 593

Topics (messages 45762 through 45842):

Re: Question on manually instantiating a file download
        45762 by: Nuno Silva

Re: Environment extract
        45763 by: Mark Maggelet
        45764 by: Philip Olson

Re: Simple If-else statement
        45765 by: Sterling
        45773 by: Louis Brooks
        45779 by: Sterling
        45780 by: Johannes Janson

Re: Cookie problem
        45766 by: Martin Skjöldebrand

Newbie - MySQL Question - Finding Unique Names in Column
        45767 by: Rami Krayem
        45769 by: Jason Lotito
        45771 by: Data Driven Design

Re: Re[PHP] Dynamic constant names -SOLVED
        45768 by: Art Wells

$myfile[$count]_type?!
        45770 by: FredrikAT
        45775 by: Matt McClanahan
        45792 by: FredrikAT
        45793 by: Philip Olson

Spacing between $row["City"],$row["State"]
        45772 by: Mike Mike
        45777 by: Philip Olson

Is it possible to have href link refer to same PHP file?
        45774 by: Michael Champagne
        45781 by: Mark Maggelet
        45787 by: Michael Champagne
        45788 by: Mark Maggelet
        45789 by: Andrew Hill

Re: "DF" output
        45776 by: Steven Shepherd
        45827 by: Joe Brown

Dynamic constant names - SOLVED
        45778 by: Geoff Caplan
        45798 by: Geoff Caplan
        45801 by: Art Wells

Opening Remote Files
        45782 by: Nick Norton
        45829 by: Yasuo Ohgaki

sort multidimensional array?
        45783 by: phpman
        45799 by: Stuart J. Browne
        45811 by: phpman

Re: POP mail delete
        45784 by: Johannes Janson

Re: Simple If-else statement - Fixed
        45785 by: Louis Brooks
        45786 by: Johannes Janson

Re: password
        45790 by: Henrik Hansen

sessions without cookies?
        45791 by: duirfire
        45828 by: Yasuo Ohgaki

data entry validation
        45794 by: Chris Worth
        45795 by: Miles Thompson

Array in Form Elements
        45796 by: Jason Lotito
        45803 by: Jack Dempsey

pdflib
        45797 by: Steffen Wieschalla

Number/Letter Passwords
        45800 by: Matt Stone
        45840 by: Yasuo Ohgaki

Re: setting Check box
        45802 by: S. Efurd
        45804 by: Peter Houchin
        45805 by: S. Efurd
        45808 by: Peter Houchin
        45809 by: David Robley

array in sessions
        45806 by: Christian Dechery
        45839 by: Yasuo Ohgaki

Re: GD problem
        45807 by: David Robley

Re: Connect local->remote
        45810 by: David Robley

No output
        45812 by: Sean B.
        45815 by: Jack Dempsey
        45816 by: Jason Murray

Re: setting Check box - THANKS!
        45813 by: S. Efurd

Problems getting php to restart samba
        45814 by: Tim Churchward

New PHP-GTK Site
        45817 by: Joe Stump

Re: [PHP-GTK] New PHP-GTK Site
        45818 by: Joe Stump
        45841 by: Richard Watson

Blah I'm Stupid
        45819 by: chris herring
        45820 by: Peter Houchin
        45821 by: David Robley
        45823 by: chris herring
        45824 by: David Robley
        45825 by: chris herring

How to send attachment with email with php?
        45822 by: Carfield Yim

Re: Im getting better :-) was Blah I'm Stupid
        45826 by: David Robley

Curious
        45830 by: YoBro
        45831 by: Chris Aitken
        45834 by: Philip Olson
        45838 by: Stuart J. Browne

guide on IMAP installation
        45832 by: Szeto

where to get info on developing web e-mail
        45833 by: Szeto

Passing Special Characters in Query String
        45835 by: Thomas Edison Jr.

Betr.: [PHP] where to get info on developing web e-mail
        45836 by: M. Verheijen

Caller's Line number?
        45837 by: elias

browscap.ini
        45842 by: Joseph Blythe

Administrivia:

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

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

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


----------------------------------------------------------------------



hello,

you could "start from the end" :)

show the nice page saying "THANKS!!" or something and this page will 
call the download script itself with "meta refresh=..." in the <head>
...can't remember the meta refresh syntax right now :)

hope it works,
Nuno


Vikram Vaswani wrote:

> Hello all,
> 
> I am working on a script which locates a file on the system and then tells
> the browser to pop open the "Save As" dialog box for download. In order to
> do this, I am using the following code:
> 
> $filename = $dataDir . $id . ".dat";
> header ("Content-Type: application/octet-stream"); 
> header ("Content-Disposition: attachment; filename=$filename"); 
> readfile($filename); 
> 
> This works fine - however, I would like to redirect the browser to another
> page once the download is complete (or once it starts). I have tried adding a 
> 
> header("Location:next.php")
> 
> line to the end of the script above, but it has no effect whatsoever (after
> the download is complete, the browser displays an hourglass as though
> waiting for something). Do I need to send some kind of "end-of-download"
> header...or something else?
> 
> Can anyone suggest some possible solutions to this problem?
> 
> Please CC a copy of your response to 
> 
> [EMAIL PROTECTED] 
> 
> as well as the list (as I will be working on this @ home also and do not
> have access to the full digest there)
> 
> Any help will be much appreciated. TIA,
> 
> Vikram Vaswani
> --
> Sex is like air. It's only a big deal if you can't get any.






On Tue, 27 Mar 2001 17:31:25 +0100, Costas ([EMAIL PROTECTED])
wrote:
>when i try printing
>
>print $HTTP_USER_AGENT;
>
>I get the error message  Undefined variable: HTTP_USER_AGENT
>
>have i missed a declaration of some sort or something else?
>
>thanks

Are you doing this from inside a function? If so you have to make it
global at the top:

function foo(){
        global $HTTP_USER_AGENT;
        echo $HTTP_USER_AGENT;
}







Ahh, that's the cause.  Here's how to duplicate the error :-)

  error_reporting(E_NOTICE);
  foo();

  function foo()
  {
      echo $HTTP_USER_AGENT;
  }

As Mark mentioned, mind your scope.  Regarding the error, I just posted
some information on this perhaps it'll be of some use :

  http://marc.theaimsgroup.com/?l=php-general&m=98571030029538&w=2

Regards,

Philip


On Tue, 27 Mar 2001, Mark Maggelet wrote:

> 
> On Tue, 27 Mar 2001 17:31:25 +0100, Costas ([EMAIL PROTECTED]) 
> wrote:
> >when i try printing
> >
> >print $HTTP_USER_AGENT;
> >
> >I get the error message  Undefined variable: HTTP_USER_AGENT
> >
> >have i missed a declaration of some sort or something else?
> >
> >thanks
> 
> Are you doing this from inside a function? If so you have to make it 
> global at the top:
> 
> function foo(){
>       global $HTTP_USER_AGENT;
>       echo $HTTP_USER_AGENT;
> }
> 
> 
> 
> 
> -- 
> 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]
> 





H-

Another solution might be to use javascript to check the fields before
the page is even submitted to make sure they put "something" in the
first and last name fields. 

Unfortunately I'm not a javascript person but I've seen it done so much
I'm sure you could find examples on the web or via a web search engine. 

As far as your code; I concure with the other posters replies: "" is
empty, " " is a space. I've made the same mistake. Also did the if
($name = "") { } Screwed me up for a bit until I remembered == is
comparison. 8^) Oh well if you don't use it you lose it. 

Take it easy. 
-Sterling


Louis Brooks wrote:
> 
> Hi:
> 
> I am trying to set up a simple script that will verify that all the blanks
> in a form have been filled out and then submit that to mySQL. If the form
> has not been completely filled out I want it to redirect them back to the
> original form. I know that the mySQL part of the script works, but I am
> unable to get the part of the script that checks the form input to see if
> everything was filled out to work. It seems to bypass this part of the
> script and enter the info into mySQL . Here is what I have so far:
> 
> If (($fname == " ") || ($lname == " "))
>          {
>                  header("Location: http://callook.org/member_joinform.html");
> }else{
>          $db = mysql_connect("localhost", "name", "password");
>          mysql_select_db("dBase",$db);
>          $sql = "INSERT INTO
> members
> (fname,lname,address,city,state,zip,country,email,username,password)
> VALUES
> ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
> name','$password')";
>          $result = mysql_query($sql);
> }
> 
> I hope the formatting comes out right. I am sure it is something simple I
> have missed but I have tried the script several different ways and nothing
> seems to work. Thank you for any help.
> 
> Sincerely,
> 
> Louis Brooks
> 
> BTW: Is there a faq for this list before I go asking anymore questions?




Thanks for everyone's response. I am still not able to get the

if(($fname="")) {

statement to work even with the suggestions everyone made so I am beginning 
to wonder if it is a problem with the server. (It is php3 on an Apache 
server. ) Any other suggestions would be greatly appreciated.

Thanks again,

Louis Brooks



At 02:29 PM 3/27/01 -0500, you wrote:
>H-
>
>Another solution might be to use javascript to check the fields before
>the page is even submitted to make sure they put "something" in the
>first and last name fields.
>
>Unfortunately I'm not a javascript person but I've seen it done so much
>I'm sure you could find examples on the web or via a web search engine.
>
>As far as your code; I concure with the other posters replies: "" is
>empty, " " is a space. I've made the same mistake. Also did the if
>($name = "") { } Screwed me up for a bit until I remembered == is
>comparison. 8^) Oh well if you don't use it you lose it.
>
>Take it easy.
>-Sterling
>
>
>Louis Brooks wrote:
> >
> > Hi:
> >
> > I am trying to set up a simple script that will verify that all the blanks
> > in a form have been filled out and then submit that to mySQL. If the form
> > has not been completely filled out I want it to redirect them back to the
> > original form. I know that the mySQL part of the script works, but I am
> > unable to get the part of the script that checks the form input to see if
> > everything was filled out to work. It seems to bypass this part of the
> > script and enter the info into mySQL . Here is what I have so far:
> >
> > If (($fname == " ") || ($lname == " "))
> >          {
> >                  header("Location: 
> http://callook.org/member_joinform.html");
> > }else{
> >          $db = mysql_connect("localhost", "name", "password");
> >          mysql_select_db("dBase",$db);
> >          $sql = "INSERT INTO
> > members
> > (fname,lname,address,city,state,zip,country,email,username,password)
> > VALUES
> > 
> ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
> > name','$password')";
> >          $result = mysql_query($sql);
> > }
> >
> > I hope the formatting comes out right. I am sure it is something simple I
> > have missed but I have tried the script several different ways and nothing
> > seems to work. Thank you for any help.
> >
> > Sincerely,
> >
> > Louis Brooks
> >
> > BTW: Is there a faq for this list before I go asking anymore questions?
>
>--
>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]





H-

Really, that's strange. 

Try printing out your variables and seeing what is actually being
passed. 

print "FNAME:$fname:\n";

With the : : colons surrounding your variable you can see what if
anything is actually in $fname. 

Also it might have been a typo on your part but be sure to check for
single = and double == when using your if statements. 

For debugging purposes do simple stuff first. 

if ($fname == "") { 
print "NOTHING HERE\n";
//    header("Location: http://callook.org/member_joinform.html");
} else {
print "Got Something: FNAME:$fname:\n";

        if (1 == 2) {
         $db = mysql_connect("localhost", "name", "password");
         mysql_select_db("dBase",$db);
         $sql = "INSERT INTO 
        members 
        (fname,lname,address,city,state,zip,country,email,username,password) 
        VALUES 

('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user 
        name','$password')";
        $result = mysql_query($sql);
        } # end if block commentor for multipe line comments. It's cleaner. 8^)

} end if-else check.

Hope this is helpful. 
-Sterling


Louis Brooks wrote:
> 
> Thanks for everyone's response. I am still not able to get the
> 
> if(($fname="")) {
> 
> statement to work even with the suggestions everyone made so I am beginning
> to wonder if it is a problem with the server. (It is php3 on an Apache
> server. ) Any other suggestions would be greatly appreciated.
> 
> Thanks again,
> 
> Louis Brooks
> 
> At 02:29 PM 3/27/01 -0500, you wrote:
> >H-
> >
> >Another solution might be to use javascript to check the fields before
> >the page is even submitted to make sure they put "something" in the
> >first and last name fields.
> >
> >Unfortunately I'm not a javascript person but I've seen it done so much
> >I'm sure you could find examples on the web or via a web search engine.
> >
> >As far as your code; I concure with the other posters replies: "" is
> >empty, " " is a space. I've made the same mistake. Also did the if
> >($name = "") { } Screwed me up for a bit until I remembered == is
> >comparison. 8^) Oh well if you don't use it you lose it.
> >
> >Take it easy.
> >-Sterling
> >
> >
> >Louis Brooks wrote:
> > >
> > > Hi:
> > >
> > > I am trying to set up a simple script that will verify that all the blanks
> > > in a form have been filled out and then submit that to mySQL. If the form
> > > has not been completely filled out I want it to redirect them back to the
> > > original form. I know that the mySQL part of the script works, but I am
> > > unable to get the part of the script that checks the form input to see if
> > > everything was filled out to work. It seems to bypass this part of the
> > > script and enter the info into mySQL . Here is what I have so far:
> > >
> > > If (($fname == " ") || ($lname == " "))
> > >          {
> > >                  header("Location:
> > http://callook.org/member_joinform.html");
> > > }else{
> > >          $db = mysql_connect("localhost", "name", "password");
> > >          mysql_select_db("dBase",$db);
> > >          $sql = "INSERT INTO
> > > members
> > > (fname,lname,address,city,state,zip,country,email,username,password)
> > > VALUES
> > >
> > ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
> > > name','$password')";
> > >          $result = mysql_query($sql);
> > > }
> > >
> > > I hope the formatting comes out right. I am sure it is something simple I
> > > have missed but I have tried the script several different ways and nothing
> > > seems to work. Thank you for any help.
> > >
> > > Sincerely,
> > >
> > > Louis Brooks
> > >
> > > BTW: Is there a faq for this list before I go asking anymore questions?
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




Hi Louis,

you cuold try it with if (empty($fname)) { redirect...
just check again that your form is ok.

Johannes

"Louis Brooks" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks for everyone's response. I am still not able to get the
>
> if(($fname="")) {
>
> statement to work even with the suggestions everyone made so I am
beginning
> to wonder if it is a problem with the server. (It is php3 on an Apache
> server. ) Any other suggestions would be greatly appreciated.
>
> Thanks again,
>
> Louis Brooks
>







Thanks everyone for all the responses.
I think I'll look into sessions in the future. Meanwhile I'll have to see 
what others come up with.

Thanks,

Martin S.




I have a listing of photos in a table as follows (not actual column names):

Image Name, Image Width, Image Height, Band Name, Venue, City, State, Date


I would like to have a list of the different bands with photos in the
archive.  There may be 120 photos of any one band, but I would like to
select the name of the band only one time and have it printed in the list.
Is there a MySQL function that would do this, or should I just put the
different bands into a separate table?

Any help would be appreciated.







> -----Original Message-----
> From: Rami Krayem [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 27, 2001 11:49 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Newbie - MySQL Question - Finding Unique Names in Column
>
>
> I have a listing of photos in a table as follows (not actual
> column names):
>
> Image Name, Image Width, Image Height, Band Name, Venue, City, State, Date
>
>
> I would like to have a list of the different bands with photos in the
> archive.  There may be 120 photos of any one band, but I would like to
> select the name of the band only one time and have it printed in the list.
> Is there a MySQL function that would do this, or should I just put the
> different bands into a separate table?
>
> Any help would be appreciated.

Split the table up into 3 tables, one for bands, one for pictures, and one
for the venue.

table_bands
fields---
band_id (pk)
band_name

table_pictures
fields---
picture_id (pk)
band_id (fk)
venue_id (fk)
picture_name
picture_width
picture_height

table_venue
fields---
venue_id (pk)
venue_name
venue_city
venue_state
venue_date


Read this and you can see how I came up with the tables.  Its covers the 4
Forms of Normalization.
http://www.newbienetwork.net/sections.php?op=viewarticle&artid=17






I think you mean distict, as in

$query = "SELECT DISTINCT band_name FROM table WHERE ...";

Data Driven Design
P.O. Box 1084
Holly Hill, FL 32125-1084

http://www.datadrivendesign.com
http://www.rossidesigns.net
----- Original Message -----
From: Rami Krayem <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 11:49 AM
Subject: [PHP] Newbie - MySQL Question - Finding Unique Names in Column


> I have a listing of photos in a table as follows (not actual column
names):
>
> Image Name, Image Width, Image Height, Band Name, Venue, City, State, Date
>
>
> I would like to have a list of the different bands with photos in the
> archive.  There may be 120 photos of any one band, but I would like to
> select the name of the band only one time and have it printed in the list.
> Is there a MySQL function that would do this, or should I just put the
> different bands into a separate table?
>
> Any help would be appreciated.
>
>
> --
> 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]
>
>





I'm sorry to jump in mid-stream here (I've been offline for a while), but
was
$constant_value=${constant_name};
suggested?

eval's spook me, so I would prefer this solution over the working
suggestion you received.

This works for me on 4.0.4:

$test_name="ta_dah";
define("constant_name","test_name");
$constant_value=${constant_name};
echo $constant_value;

-- 
March 27, 2001: Tuesday is a scissors.
  Opposed blades make a finer cut.
      --http://artwells.com/oracula/




On Tue, 27 Mar 2001, Geoff Caplan wrote:

> Hi folks
>
> I had 2 suggestions from the list:
>
> 1) indirection - $constant_value = $$constant_name ;
>
> I had already tried this, but couldn't get it to work. Unless I am
> missing something it just gives an "Undefined Variable" error.
>
> 2) eval("\$constant_value = $constant_name;") ;
>
> This does work. Thanks Paul!
>
> Geoff Caplan
>
>
>





Why can't I do $myfile[$count]_type?!
What schould I do instead?

---------------------------------
Fredrik A. Takle
[EMAIL PROTECTED]







On Tue, Mar 27, 2001 at 09:56:01PM +0200, FredrikAT wrote:

> Why can't I do $myfile[$count]_type?!
> What schould I do instead?

${$myfile[$count] . '_type'}

There are some examples in the user comments in this manual page:

http://www.php.net/manual/en/language.variables.variable.php

Matt




Hi, again!

Didn't work...

This is the scene: (file.php?a=input)
<input type=\"file\" name=\"myfile[$count]">

(file.php?a=reg)
Trying to echo type...
${$myfile[$count] . '_type'} // NOT WORKIN'
${$myfile$count}_type // NOT WORKIN'

Any suggestions?

Fredrik A. Takle
Bergen, Norway



""FredrikAT"" <[EMAIL PROTECTED]> skrev i melding
99qqqo$v1c$[EMAIL PROTECTED]">news:99qqqo$v1c$[EMAIL PROTECTED]...
> Why can't I do $myfile[$count]_type?!
> What schould I do instead?
>
> ---------------------------------
> Fredrik A. Takle
> [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>







Try this example :

<?php

    $array = array('a','b','c');
    $index = 1;

    ${$array[$index] . '_type'} = 'foo';

    print $b_type;  // prints foo

?>

Regards,

Philip


On Wed, 28 Mar 2001, FredrikAT wrote:

> Hi, again!
> 
> Didn't work...
> 
> This is the scene: (file.php?a=input)
> <input type=\"file\" name=\"myfile[$count]">
> 
> (file.php?a=reg)
> Trying to echo type...
> ${$myfile[$count] . '_type'} // NOT WORKIN'
> ${$myfile$count}_type // NOT WORKIN'
> 
> Any suggestions?
> 
> Fredrik A. Takle
> Bergen, Norway
> 
> 
> 
> ""FredrikAT"" <[EMAIL PROTECTED]> skrev i melding
> 99qqqo$v1c$[EMAIL PROTECTED]">news:99qqqo$v1c$[EMAIL PROTECTED]...
> > Why can't I do $myfile[$count]_type?!
> > What schould I do instead?
> >
> > ---------------------------------
> > Fredrik A. Takle
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> 
> -- 
> 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]
> 





Hello,
Is there a way to get spacing between
$row["City"],$row["State"] in the html output?
I've tried echo "$row["City"], nbsp; $row["State"]";
and a bunch of other things and get Parse error: parse
error, expecting `STRING' or `NUM_STRING' or `'$'' . 

The way I want the output is as follows:
Duluth MN but I get DuluthMN
Thank you
  --Mike

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text




Hi Mike,

Try this little test :

<?php

// Our array      :
   $row = array('city' => 'Seattle', 'state' => 'Washington');

// Can do in PHP4 :

   print "{$row['city']} {$row['state']}";                

// Can do anytime :

   print  $row['city'] . ' ' . $row['state']; 

?>

Not sure when "{$array['index']}" came about exactly but iirc it's not
allowed in PHP3.  Concatenating your strings is always available and
works wonderfully.


Regards,

Philip


On Tue, 27 Mar 2001, Mike Mike wrote:

> Hello,
> Is there a way to get spacing between
> $row["City"],$row["State"] in the html output?
> I've tried echo "$row["City"], nbsp; $row["State"]";
> and a bunch of other things and get Parse error: parse
> error, expecting `STRING' or `NUM_STRING' or `'$'' . 
> 
> The way I want the output is as follows:
> Duluth MN but I get DuluthMN
> Thank you
>   --Mike
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/?.refer=text
> 
> -- 
> 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]
> 






Is there a way to have an ordinary href link call some javascript and say "are
you sure blah blah blah?" and then once you hit Ok it calls the same php file
which then does all the database stuff?

I know I can do this just by creating another PHP file and having the link
call that, but it seems like it would be nicer to have this in the same file.

Thanks!

--
Michael Champagne
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]




******************************************************************
This communication is for informational purposes only.  It is not
intended as an offer or solicitation for the purchase or sale of 
any financial instrument or as an official confirmation of any 
transaction, unless specifically agreed otherwise.  All market 
prices, data and other information are not warranted as to 
completeness or accuracy and are subject to change without
notice.  Any comments or statements made herein do not 
necessarily reflect the views or opinions of Capital Institutional
Services, Inc.  Capital Institutional Services, Inc. accepts no
liability for any errors or omissions arising as a result of
transmission.  Use of this communication by other than intended
recipients is prohibited.
******************************************************************




On Tue, 27 Mar 2001 14:04:58 -0600 (Central Standard Time), Michael
Champagne ([EMAIL PROTECTED]) wrote:
>Is there a way to have an ordinary href link call some javascript
>and say "are
>you sure blah blah blah?" and then once you hit Ok it calls the same
>php file
>which then does all the database stuff?

<a href="myfile" onclick="return confirm('are you sure blah blah
blah')">

>I know I can do this just by creating another PHP file and having
>the link
>call that, but it seems like it would be nicer to have this in the
>same file.
>
>Thanks!
>
>--
>Michael Champagne
>wk: [EMAIL PROTECTED]
>hm: [EMAIL PROTECTED]
>
>
>
>
>******************************************************************
>This communication is for informational purposes only.  It is not
>intended as an offer or solicitation for the purchase or sale of
>any financial instrument or as an official confirmation of any
>transaction, unless specifically agreed otherwise.  All market
>prices, data and other information are not warranted as to
>completeness or accuracy and are subject to change without
>notice.  Any comments or statements made herein do not
>necessarily reflect the views or opinions of Capital Institutional
>Services, Inc.  Capital Institutional Services, Inc. accepts no
>liability for any errors or omissions arising as a result of
>transmission.  Use of this communication by other than intended
>recipients is prohibited.
>******************************************************************
>
>--
>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: php-list-
>[EMAIL PROTECTED]






But then how would you process it in the same file?  If I'm calling it from
myfile and my link is to myfile then how does it know that it's already been
clicked?

Thanks,
Mike

> On Tue, 27 Mar 2001 14:04:58 -0600 (Central Standard Time), Michael
> Champagne ([EMAIL PROTECTED]) wrote:
> >Is there a way to have an ordinary href link call some javascript
> >and say "are
> >you sure blah blah blah?" and then once you hit Ok it calls the same
> >php file
> >which then does all the database stuff?
>
> <a href="myfile" onclick="return confirm('are you sure blah blah
> blah')">
>
> >I know I can do this just by creating another PHP file and having
> >the link
> >call that, but it seems like it would be nicer to have this in the
> >same file.
> >
> >Thanks!
> >
> >--
> >Michael Champagne
> >wk: [EMAIL PROTECTED]
> >hm: [EMAIL PROTECTED]
> >
> >
> >
> >
> >******************************************************************
> >This communication is for informational purposes only.  It is not
> >intended as an offer or solicitation for the purchase or sale of
> >any financial instrument or as an official confirmation of any
> >transaction, unless specifically agreed otherwise.  All market
> >prices, data and other information are not warranted as to
> >completeness or accuracy and are subject to change without
> >notice.  Any comments or statements made herein do not
> >necessarily reflect the views or opinions of Capital Institutional
> >Services, Inc.  Capital Institutional Services, Inc. accepts no
> >liability for any errors or omissions arising as a result of
> >transmission.  Use of this communication by other than intended
> >recipients is prohibited.
> >******************************************************************
> >
> >--
> >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: php-list-
> >[EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>

-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



******************************************************************
This communication is for informational purposes only.  It is not
intended as an offer or solicitation for the purchase or sale of 
any financial instrument or as an official confirmation of any 
transaction, unless specifically agreed otherwise.  All market 
prices, data and other information are not warranted as to 
completeness or accuracy and are subject to change without
notice.  Any comments or statements made herein do not 
necessarily reflect the views or opinions of Capital Institutional
Services, Inc.  Capital Institutional Services, Inc. accepts no
liability for any errors or omissions arising as a result of
transmission.  Use of this communication by other than intended
recipients is prohibited.
******************************************************************




On Tue, 27 Mar 2001 15:50:44 -0600 (Central Standard Time), Michael
Champagne ([EMAIL PROTECTED]) wrote:
>But then how would you process it in the same file?  If I'm calling
>it from
>myfile and my link is to myfile then how does it know that it's
>already been
>clicked?

well you can make the url be:
myfile?clicked=true

then do
if(isset($clicked)){
        // do stuff
}

up at the top.

- Mark

>Thanks,
>Mike
>
>> On Tue, 27 Mar 2001 14:04:58 -0600 (Central Standard Time),
Michael
>> Champagne ([EMAIL PROTECTED]) wrote:
>> >Is there a way to have an ordinary href link call some javascript
>> >and say "are
>> >you sure blah blah blah?" and then once you hit Ok it calls the
>>same
>> >php file
>> >which then does all the database stuff?
>>
>> <a href="myfile" onclick="return confirm('are you sure blah blah
>> blah')">
>>
>> >I know I can do this just by creating another PHP file and having
>> >the link
>> >call that, but it seems like it would be nicer to have this in
the
>> >same file.
>> >
>> >Thanks!
>> >
>> >--
>> >Michael Champagne
>> >wk: [EMAIL PROTECTED]
>> >hm: [EMAIL PROTECTED]
>> >
>> >
>> >
>> >
>>
>******************************************************************
>> >This communication is for informational purposes only.  It is not
>> >intended as an offer or solicitation for the purchase or sale of
>> >any financial instrument or as an official confirmation of any
>> >transaction, unless specifically agreed otherwise.  All market
>> >prices, data and other information are not warranted as to
>> >completeness or accuracy and are subject to change without
>> >notice.  Any comments or statements made herein do not
>> >necessarily reflect the views or opinions of Capital
Institutional
>> >Services, Inc.  Capital Institutional Services, Inc. accepts no
>> >liability for any errors or omissions arising as a result of
>> >transmission.  Use of this communication by other than intended
>> >recipients is prohibited.
>>
>******************************************************************
>> >
>> >--
>> >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: php-list-
>> >[EMAIL PROTECTED]
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: php-list-
>>[EMAIL PROTECTED]
>>
>>
>
>--
>Michael Champagne, Software Engineer
>Capital Institutional Services, Inc.
>wk: [EMAIL PROTECTED]
>hm: [EMAIL PROTECTED]
>
>
>
>******************************************************************
>This communication is for informational purposes only.  It is not
>intended as an offer or solicitation for the purchase or sale of
>any financial instrument or as an official confirmation of any
>transaction, unless specifically agreed otherwise.  All market
>prices, data and other information are not warranted as to
>completeness or accuracy and are subject to change without
>notice.  Any comments or statements made herein do not
>necessarily reflect the views or opinions of Capital Institutional
>Services, Inc.  Capital Institutional Services, Inc. accepts no
>liability for any errors or omissions arising as a result of
>transmission.  Use of this communication by other than intended
>recipients is prohibited.
>******************************************************************
>
>--
>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: php-list-
>[EMAIL PROTECTED]






Just check the value of the submit variable.
If it's populated, then the form has been clicked.

Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com


On 3/27/01 4:50 PM, "Michael Champagne" <[EMAIL PROTECTED]> wrote:

> But then how would you process it in the same file?  If I'm calling it from
> myfile and my link is to myfile then how does it know that it's already been
> clicked?
> 
> Thanks,
> Mike
>> 





Brad, 

Thanks for the response.  Either method they both work via command
line.  Neither of them work in the browser.

On Tue, 27 Mar 2001, Brad S. Jackson wrote:

> 
> Try $top = `top n 1 b | head -8 | sed 's/[\$|^M]//g'`;
> 
> In my experience, you can't use | in exec calls, you have to use the back tick
> method.
> 
> 
> Steven Shepherd <[EMAIL PROTECTED]> wrote:
> Bad example (changed to ps and it works actually..but i dont want 'ps', I
> want 'top').  Ran top using su to the user 'www' from the command line and
> was able to run it fine.
> 
> On Tue, 27 Mar 2001, Joe Brown wrote:
> 
> > Date: Tue, 27 Mar 2001 12:35:08 -0500
> > From: Joe Brown <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] "DF" output
> >
> > nobody has execute permission on ps?
> >
> > Probably quite the opposite, your webserver user doesn't have execute
> > permission on ps, so there is no execution or return value.
> >
> > "Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I am writing a script, actually modifying PhPSysInfo to include the top
> > > processes used on a machine.  So far, no matter what I do, I can only get
> > > it to work via the command line.  I get a blank screen when trying it via
> > > the browser:
> > >
> > > Tried this:
> > >
> > > <?php
> > > $data = `ps auxwww`; echo nl2br($data);
> > > ?>
> > >
> > > ------------------------------------------------
> > > and this:
> > >
> > > <TT>
> > > <PRE>
> > > <?php
> > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> > > while (list(,$line) = each($top)){
> > >  echo $line, "<BR>\n";
> > >   }
> > >  ?>
> > > </PRE>
> > > </TT>
> > >
> > > I used sed to remove control characters..etc.  Again, both examples above
> > > work via the command line, but not via a browser.  User "www" is able to
> > > run this command as well, so it's not permissions.  Help?!  :)
> > >
> > >
> > > --
> 
> 
> 





heh,
dunno, maybe the $PATH  environment var doesn't include /sbin or /usr/sbin.

Test w 'ls' see if you can get a directory listing, at least?

"Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Brad,
>
> Thanks for the response.  Either method they both work via command
> line.  Neither of them work in the browser.
>
> On Tue, 27 Mar 2001, Brad S. Jackson wrote:
>
> >
> > Try $top = `top n 1 b | head -8 | sed 's/[\$|^M]//g'`;
> >
> > In my experience, you can't use | in exec calls, you have to use the
back tick
> > method.
> >
> >
> > Steven Shepherd <[EMAIL PROTECTED]> wrote:
> > Bad example (changed to ps and it works actually..but i dont want 'ps',
I
> > want 'top').  Ran top using su to the user 'www' from the command line
and
> > was able to run it fine.
> >
> > On Tue, 27 Mar 2001, Joe Brown wrote:
> >
> > > Date: Tue, 27 Mar 2001 12:35:08 -0500
> > > From: Joe Brown <[EMAIL PROTECTED]>
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] "DF" output
> > >
> > > nobody has execute permission on ps?
> > >
> > > Probably quite the opposite, your webserver user doesn't have execute
> > > permission on ps, so there is no execution or return value.
> > >
> > > "Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > I am writing a script, actually modifying PhPSysInfo to include the
top
> > > > processes used on a machine.  So far, no matter what I do, I can
only get
> > > > it to work via the command line.  I get a blank screen when trying
it via
> > > > the browser:
> > > >
> > > > Tried this:
> > > >
> > > > <?php
> > > > $data = `ps auxwww`; echo nl2br($data);
> > > > ?>
> > > >
> > > > ------------------------------------------------
> > > > and this:
> > > >
> > > > <TT>
> > > > <PRE>
> > > > <?php
> > > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> > > > while (list(,$line) = each($top)){
> > > >  echo $line, "<BR>\n";
> > > >   }
> > > >  ?>
> > > > </PRE>
> > > > </TT>
> > > >
> > > > I used sed to remove control characters..etc.  Again, both examples
above
> > > > work via the command line, but not via a browser.  User "www" is
able to
> > > > run this command as well, so it's not permissions.  Help?!  :)
> > > >
> > > >
> > > > --
> >
> >
> >
>
>
> --
> 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]
>






Hi folks

I mailed this to the list some time ago, but it seems to have got
"lost" so here is is again...

I had 2 suggestions from the list:

1) indirection - $constant_value = $$constant_name ;

I had already tried this, but couldn't get it to work. Unless I am
missing something it just gives an "Undefined Variable" error.

2) eval("\$constant_value = $constant_name;") ;

This does work. Thanks Paul and CC!

Geoff Caplan






Art,

Thanks for the suggestion, but I think there is a flaw in your
solution.

The original issue was how to get at the value of a constant where the
$constant_name is dynamically created as a variable.

In your solution you have defined constant_name as a constant!
So when you assign it, it does, of course, behave as a constant.

I don't think the ${...} notation is doing anything - it is just being
ignored by the parser so far as I can see ...

AW> $test_name="ta_dah";
AW> define("constant_name","test_name");
AW> $constant_value=${constant_name};

Geoff Caplan






My apologies for assuming too much of the variable names.  Thank you for
correcting me.

Your response has caused me good confusion though.  If I remove the ${...}
notation I get quite a different output (specifically, there's no output).
Are you sure the parser ignores it?

This is the code I suggested WITHOUT the ${...} that returns nothing.
$test_name="ta_dah";
define("constant_name","test_name");
$constant_value=$constant_name;
echo $constant_value;

And I wonder too if my odd usage of ${...} notation is improper in
variables.  When I want to create a dynamically named variable (as opposed
to my off-topic constant example), I use:

${$variable_name}="value";
or even
${"fixed_string".$variable_name}="value";

I hope I'm not going against sane practices in doing so.

On Wed, 28 Mar 2001, Geoff Caplan wrote:

> Art,
>
> Thanks for the suggestion, but I think there is a flaw in your
> solution.
>
> The original issue was how to get at the value of a constant where the
> $constant_name is dynamically created as a variable.
>
> In your solution you have defined constant_name as a constant!
> So when you assign it, it does, of course, behave as a constant.
>
> I don't think the ${...} notation is doing anything - it is just being
> ignored by the parser so far as I can see ...
>
> AW> $test_name="ta_dah";
> AW> define("constant_name","test_name");
> AW> $constant_value=${constant_name};
>
> Geoff Caplan
>
>

-- 
March 27, 2001: Tuesday is a scissors.
  Opposed blades make a finer cut.
      --http://artwells.com/oracula/





Does anyone know of a method to read a remote password protected file
without actually downloading it locally and then reading?

- Nick





""Nick Norton"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone know of a method to read a remote password protected file
> without actually downloading it locally and then reading?

I suppose you must download file before reading.
There are so many ways to protect file with passwords. We need to specify how
files are protected to help you.
i.e. Is it FTP? Protected by a proxy? WWW Basich Auth or Custom authentication?

Regards,
--
Yasuo Ohgaki

>
> - Nick
>
>
> --
> 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]
>





 Hello,

 i have this code:

while ($row = mysql_fetch_array($results)) {
    $tmp = get_item_reorder_priority($row["item_sku"]);
    $list[$r]["priority"] = $tmp[0];
    $list[$r]["sku"] = $row["item_sku"];
    $r++;
   }

   $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);

and it returns this error:
  Warning: Argument 1 to array_multisort() is expected to be an array or a
sort flag in d://www/inventory_specific.phtml on line 109

  function get_item_reorder_priority() returns an array - with $tmp[0] being
an integer 1-5
  $row["item_sku"] is simply a string.

  I'm trying to sort by priority numbers (1-5). Any help would be
appreciated.

  -dave






> while ($row = mysql_fetch_array($results)) {
>     $tmp = get_item_reorder_priority($row["item_sku"]);
>     $list[$r]["priority"] = $tmp[0];
>     $list[$r]["sku"] = $row["item_sku"];
>     $r++;
>    }
>
>    $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);
>
> and it returns this error:
>   Warning: Argument 1 to array_multisort() is expected to be an array or a
> sort flag in d://www/inventory_specific.phtml on line 109
>
>   function get_item_reorder_priority() returns an array - with $tmp[0]
being
> an integer 1-5
>   $row["item_sku"] is simply a string.


Umm, dunno about anybody else but it appears as if you are missing a
dimension..

In the array creation:

        $list[$r]["priority"]

is used.. emphasis on the [$r] part.

When trying to re-order, you are using just $list["priority"].  missing the
[$r] dimension..

bkx






I'm still confused. I'm looking to sort the list[$r] part of the array based
on what value $list[$r]["priority"] is. What would the function's arguments
be?

""Stuart J. Browne"" <[EMAIL PROTECTED]> wrote in message
99rajk$i0v$[EMAIL PROTECTED]">news:99rajk$i0v$[EMAIL PROTECTED]...
> > while ($row = mysql_fetch_array($results)) {
> >     $tmp = get_item_reorder_priority($row["item_sku"]);
> >     $list[$r]["priority"] = $tmp[0];
> >     $list[$r]["sku"] = $row["item_sku"];
> >     $r++;
> >    }
> >
> >    $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);
> >
> > and it returns this error:
> >   Warning: Argument 1 to array_multisort() is expected to be an array or
a
> > sort flag in d://www/inventory_specific.phtml on line 109
> >
> >   function get_item_reorder_priority() returns an array - with $tmp[0]
> being
> > an integer 1-5
> >   $row["item_sku"] is simply a string.
>
>
> Umm, dunno about anybody else but it appears as if you are missing a
> dimension..
>
> In the array creation:
>
>         $list[$r]["priority"]
>
> is used.. emphasis on the [$r] part.
>
> When trying to re-order, you are using just $list["priority"].  missing
the
> [$r] dimension..
>
> bkx
>
>
>
> --
> 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]
>






Hi,

i'm not that much into mail functions but my manual tells
me that impa_delete selects a message to be deleted.
imp_expunge delets all selected messages.

look into the correct syntax

Johannes

"Miguel Carvalho" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I, i'm a little new to PHP.
>
> I'm sorry if this question has already be answerd, but i have i have
> searched the list, and i have not found any arcticle about it.
>
> My question is:
>     How do i delete a message from a POP server, using  PHP functions?
>
> I have tried, imap_setflag_full, imap_delete, but no luck.
>
> Can any one point me to some solution?
>
> If possible, i dont want to dig into the POP protocol.
>
> Thanks.
> Miguel Carvalho
>
>
> --
> 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]
>






Thanks for all the help. I finally got it to work. I ended up using a bunch 
of if ($lname=="") { statements instead of if (($lname=="") || 
($fname=="")) { and that seems to be working. I still can't get the 
header() statement to work. So I just cheated and put in some text telling 
the user to hit the back button and fill out the rest of the information on 
the form.

Louis


At 02:29 PM 3/27/01 -0500, you wrote:
>H-
>
>Another solution might be to use javascript to check the fields before
>the page is even submitted to make sure they put "something" in the
>first and last name fields.
>
>Unfortunately I'm not a javascript person but I've seen it done so much
>I'm sure you could find examples on the web or via a web search engine.
>
>As far as your code; I concure with the other posters replies: "" is
>empty, " " is a space. I've made the same mistake. Also did the if
>($name = "") { } Screwed me up for a bit until I remembered == is
>comparison. 8^) Oh well if you don't use it you lose it.
>
>Take it easy.
>-Sterling
>
>
>Louis Brooks wrote:
> >
> > Hi:
> >
> > I am trying to set up a simple script that will verify that all the blanks
> > in a form have been filled out and then submit that to mySQL. If the form
> > has not been completely filled out I want it to redirect them back to the
> > original form. I know that the mySQL part of the script works, but I am
> > unable to get the part of the script that checks the form input to see if
> > everything was filled out to work. It seems to bypass this part of the
> > script and enter the info into mySQL . Here is what I have so far:
> >
> > If (($fname == " ") || ($lname == " "))
> >          {
> >                  header("Location: 
> http://callook.org/member_joinform.html");
> > }else{
> >          $db = mysql_connect("localhost", "name", "password");
> >          mysql_select_db("dBase",$db);
> >          $sql = "INSERT INTO
> > members
> > (fname,lname,address,city,state,zip,country,email,username,password)
> > VALUES
> > 
> ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
> > name','$password')";
> >          $result = mysql_query($sql);
> > }
> >
> > I hope the formatting comes out right. I am sure it is something simple I
> > have missed but I have tried the script several different ways and nothing
> > seems to work. Thank you for any help.
> >
> > Sincerely,
> >
> > Louis Brooks
> >
> > BTW: Is there a faq for this list before I go asking anymore questions?
>
>--
>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]




Hi,

for the haeder just make sure that there is NO output
whatsoever before the header-call. even if line 1 of your
script is empty before the <?php-tag the header doesn't work.


"Louis Brooks" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks for all the help. I finally got it to work. I ended up using a
bunch
> of if ($lname=="") { statements instead of if (($lname=="") ||
> ($fname=="")) { and that seems to be working. I still can't get the
> header() statement to work. So I just cheated and put in some text telling
> the user to hit the back button and fill out the rest of the information
on
> the form.
>
> Louis
>
>







"Marisol Díaz E." <[EMAIL PROTECTED]> wrote:

 > 1.  (*) text/plain          
 > 
 > Hi
 > 
 > I need the code, for protecting the dir by password.

take a look at htaccess files

-- 
Henrik Hansen





Hi, can someone point me toward a tutorial that shows how to register info
(e.g. username, login status, and user preferences) and do this in a session
without using cookies... is this even possible?

thanks!
duirfire





You can use URL mode for PHP4 session if you want session w/o cookie.

How about read this link?
http://www.zend.com/zend/tut/session.php

--
Yasuo Ohgaki


"duirfire" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi, can someone point me toward a tutorial that shows how to register info
> (e.g. username, login status, and user preferences) and do this in a session
> without using cookies... is this even possible?
>
> thanks!
> duirfire
>
>
> --
> 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]
>






I'm working with some forms that need the data validated.  Dates, times etc.

my question is, how do I "reset" the form back to the original screen with variables 
intact so they can make the changes?

is there a code snippet some place i can work with?

thanks,

chris






Chris,

Go to www.thickbook.com. Julie Meloni has a tutorial there which gives you 
exactly what you want. It's the one which has to do with custom error 
messages, which , believe or not, are on the subject of data validation.

Miles

At 06:31 PM 3/27/01 -0500, Chris Worth wrote:

>I'm working with some forms that need the data validated.  Dates, times etc.
>
>my question is, how do I "reset" the form back to the original screen with 
>variables
>intact so they can make the changes?
>
>is there a code snippet some place i can work with?
>
>thanks,
>
>chris
>
>
>
>--
>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]





Okay, here is the question, I have a form that will continue to grow in the
number of elements that it contains.  The values are passed into a function,
and then written out to a file.

Currently, I have 38 seperate values that are being passed into this
function, making the arguments for the function very long.  Now, I know I
can pass an array into a function, however, I would like to know if there
was a way to name the elements of the form as in an array, for example:

<input name="array[1]" type="text">
<input name="array[2]" type="text">
<input name="array[3]" type="text">
<input name="array[4]" type="text">

and then, rather than having to pass all 38 seperate arguements into the
function, I could simply pass the array like this:

function_name($array);

And then simply dissect the array inside the function like normal?

Thanks

Jason Lotito
www.NewbieNetwork.net
Where those who can, teach;
and those who can, learn.





<input name="array[]" type="text">

i used something like this in a series of checkbox's to grab all the
values in an array....i'm not sure if it can be used in this way though,
but give it a go...

-jack

Jason Lotito wrote:
> 
> Okay, here is the question, I have a form that will continue to grow in the
> number of elements that it contains.  The values are passed into a function,
> and then written out to a file.
> 
> Currently, I have 38 seperate values that are being passed into this
> function, making the arguments for the function very long.  Now, I know I
> can pass an array into a function, however, I would like to know if there
> was a way to name the elements of the form as in an array, for example:
> 
> <input name="array[1]" type="text">
> <input name="array[2]" type="text">
> <input name="array[3]" type="text">
> <input name="array[4]" type="text">
> 
> and then, rather than having to pass all 38 seperate arguements into the
> function, I could simply pass the array like this:
> 
> function_name($array);
> 
> And then simply dissect the array inside the function like normal?
> 
> Thanks
> 
> Jason Lotito
> www.NewbieNetwork.net
> Where those who can, teach;
> and those who can, learn.
> 
> --
> 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]




Hi!

Is there any possibility to import an existing pdf file in PHP 4.0.4pl1
(pdflib 3.0.3) to modify it?

Thanks in advance!

Ciao
  Steffen
---
+-----------------------------------------------------------------------+
|     Steffen Wieschalla                                                |
|     e-mail: [EMAIL PROTECTED]                      |
|     WWW   : http://www-ti.informatik.uni-tuebingen.de/~wieschal/      |
+-----------------------------------------------------------------------+
       "Shock your systemadministration! Read manual-pages!"





Hi,Hi,
I have this code below which is supposed to be generating a password like
QCCQCN2-IUZ with 10 characters - All but three in the first section (7) and
three in the last part - but does not work in all cases. Sometimes it prints
LPSA3WD-IM or G22G2G9-FC.
Is there a catch in the code that will stuff up in certain circumstances?
Please help,

Matt stone

_________________________________________________

<?php
define(FIRST_STR,1);
define(LAST_STR,0);

function randomGen($length, $mode) {
         $all = explode( " ",
                                 "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
               . "0 1 2 3 4 5 6 7 8 9");
         $allend = explode( " ",
                                 "A B C D E F G H I J K L M N O P Q R S T U V W X Y 
Z");
          for($i=0;$i<$length;$i++) {
            srand((double)microtime()*time());
            $randy = (($mode)? rand(0, count($all)) : rand(0, count($allend)));
            $pass .= (($mode)? $all[$randy] : $allend[$randy]);
          }
        return $pass;
}

function randomPassword($length = 8) {
        $passfirst = randomGen($length-3, FIRST_STR);
        $passend = randomGen(3, LAST_STR);
        $pass = $passfirst.'-'.$passend;
        return $pass;
}

for($i;$i<10;$i++){
        $new_random = randomPassword(10);
        echo "$new_random<br>";
}
?>





""Matt Stone"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,Hi,
> I have this code below which is supposed to be generating a password like
> QCCQCN2-IUZ with 10 characters - All but three in the first section (7) and
> three in the last part - but does not work in all cases. Sometimes it prints
> LPSA3WD-IM or G22G2G9-FC.
> Is there a catch in the code that will stuff up in certain circumstances?
> Please help,
>
> Matt stone
>
> _________________________________________________
>
> <?php
> define(FIRST_STR,1);
> define(LAST_STR,0);
>
> function randomGen($length, $mode) {
> $all = explode( " ",
> "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
>        . "0 1 2 3 4 5 6 7 8 9");
> $allend = explode( " ",
> "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
>   for($i=0;$i<$length;$i++) {
>     srand((double)microtime()*time());
>     $randy = (($mode)? rand(0, count($all)) : rand(0, count($allend)));

Count returns number of elements in array, so you should substrct 1. i.e.

$randy = (($mode)? rand(0, count($all)-1) : rand(0, count($allend)-1));

Then should work all the time.

Regards,
--
Yasuo Ohgaki






This worked for me as well, and helped me with a problem I was having!

How would you show what option was selected in a drop down box. I have a
form the user fills out, this goes to a confirmation page to ensure the data
enetered is correct. I have a drop down box for states, and I cant seem to
make it show the state selected it always defaults to first choice?

Thanks




----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: "Peter Houchin" <[EMAIL PROTECTED]>; "Php-General@Lists. Php. Net"
<[EMAIL PROTECTED]>
Sent: Monday, March 26, 2001 11:37 PM
Subject: Re: [PHP] setting Check box


> On Tue, 27 Mar 2001 14:24, Peter Houchin wrote:
> > >> Hiya can some one pls let me know if i am on the right track pls,
> > >> this is in a form that updates if there is an id else it inserts,
> > >> now what i want it if there is an id i want the check box to be
> > >> either checked or unchecked depending on the 'y' / 'n' value in the
> > >> db
> >
> >
> >
> > >> <input type="checkbox" name="avail" value="" <? if ($avail == 'n')
> > >> { echo 'SELECTED '; }?>">
> >
> >
> >
> > >> Peter Houchin
> >
> >
> >
> > > Try CHECKED for checkboxes - SELECTED works for dropdowns.
> >
> >
> > ok I've changed it the SELECT to CHECKED but it had no effect ...
> > <input type="checkbox" name="avail" value="" <? if ($avail == 'n') {
> > echo 'CHECKED'; }?>>
> > I've also tried it with a "n" value  so it reads like
> > <input type="checkbox" name="avail" value="n" <? if ($avail == 'n') {
> > echo 'CHECKED'; }?>> but that didn't have any luck either ... is there
> > anything else i can do?
> > Peter
>
> Well, this little snippet works for me...
>
> <?php
> $avail = 'n';
> ?>
>
> <FORM ACTION=check.php METHOD=GET>
> <input type="checkbox" name="avail" value="" <?php if ($avail == 'n')

> echo 'CHECKED'; }?>>
> <INPUT TYPE=SUBMIT>
> </FORM>
>
> <?php
> if(isset($avail)) {
> echo "Value of AVAIL: $avail";
> }
> ?>
>
> If you aren't getting the value you expect in $avail you may have
> problems.
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> 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]
>
>





use 
<SELECT NAME="foo"> <OPTION VALUE="bar" <? if ($areacode == 'bar') { echo 'SELECTED '; 
}?>>foo bar</OPTION>

Peter
Ps thanks again David & Jason M & Phillip for your help :>
-----Original Message-----
From: S. Efurd [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] setting Check box


This worked for me as well, and helped me with a problem I was having!

How would you show what option was selected in a drop down box. I have a
form the user fills out, this goes to a confirmation page to ensure the data
enetered is correct. I have a drop down box for states, and I cant seem to
make it show the state selected it always defaults to first choice?

Thanks




----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: "Peter Houchin" <[EMAIL PROTECTED]>; "Php-General@Lists. Php. Net"
<[EMAIL PROTECTED]>
Sent: Monday, March 26, 2001 11:37 PM
Subject: Re: [PHP] setting Check box


> On Tue, 27 Mar 2001 14:24, Peter Houchin wrote:
> > >> Hiya can some one pls let me know if i am on the right track pls,
> > >> this is in a form that updates if there is an id else it inserts,
> > >> now what i want it if there is an id i want the check box to be
> > >> either checked or unchecked depending on the 'y' / 'n' value in the
> > >> db
> >
> >
> >
> > >> <input type="checkbox" name="avail" value="" <? if ($avail == 'n')
> > >> { echo 'SELECTED '; }?>">
> >
> >
> >
> > >> Peter Houchin
> >
> >
> >
> > > Try CHECKED for checkboxes - SELECTED works for dropdowns.
> >
> >
> > ok I've changed it the SELECT to CHECKED but it had no effect ...
> > <input type="checkbox" name="avail" value="" <? if ($avail == 'n') {
> > echo 'CHECKED'; }?>>
> > I've also tried it with a "n" value  so it reads like
> > <input type="checkbox" name="avail" value="n" <? if ($avail == 'n') {
> > echo 'CHECKED'; }?>> but that didn't have any luck either ... is there
> > anything else i can do?
> > Peter
>
> Well, this little snippet works for me...
>
> <?php
> $avail = 'n';
> ?>
>
> <FORM ACTION=check.php METHOD=GET>
> <input type="checkbox" name="avail" value="" <?php if ($avail == 'n')

> echo 'CHECKED'; }?>>
> <INPUT TYPE=SUBMIT>
> </FORM>
>
> <?php
> if(isset($avail)) {
> echo "Value of AVAIL: $avail";
> }
> ?>
>
> If you aren't getting the value you expect in $avail you may have
> problems.
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


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





I thought about doing it this way, but repeating this 50 times seems a bit
ineffecient, perhaps i am looking for a shortcut that does not exist? I had
hoped I was missing something obivious.

Thanks
Steve

----- Original Message -----
From: "Peter Houchin" <[EMAIL PROTECTED]>
To: "S. Efurd" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 7:08 PM
Subject: RE: [PHP] setting Check box


> use
> <SELECT NAME="foo"> <OPTION VALUE="bar" <? if ($areacode == 'bar') { echo
'SELECTED '; }?>>foo bar</OPTION>
>
> Peter
> Ps thanks again David & Jason M & Phillip for your help :>
> -----Original Message-----
> From: S. Efurd [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 28, 2001 10:48 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] setting Check box
>
>
> This worked for me as well, and helped me with a problem I was having!
>
> How would you show what option was selected in a drop down box. I have a
> form the user fills out, this goes to a confirmation page to ensure the
data
> enetered is correct. I have a drop down box for states, and I cant seem to
> make it show the state selected it always defaults to first choice?
>
> Thanks
>
>
>
>
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: "Peter Houchin" <[EMAIL PROTECTED]>; "Php-General@Lists. Php. Net"
> <[EMAIL PROTECTED]>
> Sent: Monday, March 26, 2001 11:37 PM
> Subject: Re: [PHP] setting Check box
>
>
> > On Tue, 27 Mar 2001 14:24, Peter Houchin wrote:
> > > >> Hiya can some one pls let me know if i am on the right track pls,
> > > >> this is in a form that updates if there is an id else it inserts,
> > > >> now what i want it if there is an id i want the check box to be
> > > >> either checked or unchecked depending on the 'y' / 'n' value in the
> > > >> db
> > >
> > >
> > >
> > > >> <input type="checkbox" name="avail" value="" <? if ($avail == 'n')
> > > >> { echo 'SELECTED '; }?>">
> > >
> > >
> > >
> > > >> Peter Houchin
> > >
> > >
> > >
> > > > Try CHECKED for checkboxes - SELECTED works for dropdowns.
> > >
> > >
> > > ok I've changed it the SELECT to CHECKED but it had no effect ...
> > > <input type="checkbox" name="avail" value="" <? if ($avail == 'n') {
> > > echo 'CHECKED'; }?>>
> > > I've also tried it with a "n" value  so it reads like
> > > <input type="checkbox" name="avail" value="n" <? if ($avail == 'n') {
> > > echo 'CHECKED'; }?>> but that didn't have any luck either ... is there
> > > anything else i can do?
> > > Peter
> >
> > Well, this little snippet works for me...
> >
> > <?php
> > $avail = 'n';
> > ?>
> >
> > <FORM ACTION=check.php METHOD=GET>
> > <input type="checkbox" name="avail" value="" <?php if ($avail == 'n')
>
> > echo 'CHECKED'; }?>>
> > <INPUT TYPE=SUBMIT>
> > </FORM>
> >
> > <?php
> > if(isset($avail)) {
> > echo "Value of AVAIL: $avail";
> > }
> > ?>
> >
> > If you aren't getting the value you expect in $avail you may have
> > problems.
> >
> > --
> > David Robley                        | WEBMASTER & Mail List Admin
> > RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> > AusEinet                            | http://auseinet.flinders.edu.au/
> >             Flinders University, ADELAIDE, SOUTH AUSTRALIA
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





am not sure if it would work or not but maybe if you tried 
$foo= if ($areacode == '$bar') { echo
'SELECTED '; }

<SELECT NAME="foo"> <OPTION VALUE="bar"<? $foo ?>>foo bar</OPTION>

-----Original Message-----
From: S. Efurd [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 11:20 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] setting Check box


I thought about doing it this way, but repeating this 50 times seems a bit
ineffecient, perhaps i am looking for a shortcut that does not exist? I had
hoped I was missing something obivious.

Thanks
Steve

----- Original Message -----
From: "Peter Houchin" <[EMAIL PROTECTED]>
To: "S. Efurd" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 7:08 PM
Subject: RE: [PHP] setting Check box


> use
> <SELECT NAME="foo"> <OPTION VALUE="bar" <? if ($areacode == 'bar') { echo
'SELECTED '; }?>>foo bar</OPTION>
>
> Peter
> Ps thanks again David & Jason M & Phillip for your help :>
> -----Original Message-----
> From: S. Efurd [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 28, 2001 10:48 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] setting Check box
>
>
> This worked for me as well, and helped me with a problem I was having!
>
> How would you show what option was selected in a drop down box. I have a
> form the user fills out, this goes to a confirmation page to ensure the
data
> enetered is correct. I have a drop down box for states, and I cant seem to
> make it show the state selected it always defaults to first choice?
>
> Thanks
>
>
>
>
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: "Peter Houchin" <[EMAIL PROTECTED]>; "Php-General@Lists. Php. Net"
> <[EMAIL PROTECTED]>
> Sent: Monday, March 26, 2001 11:37 PM
> Subject: Re: [PHP] setting Check box
>
>
> > On Tue, 27 Mar 2001 14:24, Peter Houchin wrote:
> > > >> Hiya can some one pls let me know if i am on the right track pls,
> > > >> this is in a form that updates if there is an id else it inserts,
> > > >> now what i want it if there is an id i want the check box to be
> > > >> either checked or unchecked depending on the 'y' / 'n' value in the
> > > >> db
> > >
> > >
> > >
> > > >> <input type="checkbox" name="avail" value="" <? if ($avail == 'n')
> > > >> { echo 'SELECTED '; }?>">
> > >
> > >
> > >
> > > >> Peter Houchin
> > >
> > >
> > >
> > > > Try CHECKED for checkboxes - SELECTED works for dropdowns.
> > >
> > >
> > > ok I've changed it the SELECT to CHECKED but it had no effect ...
> > > <input type="checkbox" name="avail" value="" <? if ($avail == 'n') {
> > > echo 'CHECKED'; }?>>
> > > I've also tried it with a "n" value  so it reads like
> > > <input type="checkbox" name="avail" value="n" <? if ($avail == 'n') {
> > > echo 'CHECKED'; }?>> but that didn't have any luck either ... is there
> > > anything else i can do?
> > > Peter
> >
> > Well, this little snippet works for me...
> >
> > <?php
> > $avail = 'n';
> > ?>
> >
> > <FORM ACTION=check.php METHOD=GET>
> > <input type="checkbox" name="avail" value="" <?php if ($avail == 'n')
>
> > echo 'CHECKED'; }?>>
> > <INPUT TYPE=SUBMIT>
> > </FORM>
> >
> > <?php
> > if(isset($avail)) {
> > echo "Value of AVAIL: $avail";
> > }
> > ?>
> >
> > If you aren't getting the value you expect in $avail you may have
> > problems.
> >
> > --
> > David Robley                        | WEBMASTER & Mail List Admin
> > RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> > AusEinet                            | http://auseinet.flinders.edu.au/
> >             Flinders University, ADELAIDE, SOUTH AUSTRALIA
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
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]





On Wed, 28 Mar 2001 10:18, S. Efurd wrote:
> This worked for me as well, and helped me with a problem I was having!
>
> How would you show what option was selected in a drop down box. I have
> a form the user fills out, this goes to a confirmation page to ensure
> the data enetered is correct. I have a drop down box for states, and I
> cant seem to make it show the state selected it always defaults to
> first choice?
>
> Thanks

I've built a function for displaying drop down lists: yours for free. Oh 
look, Ive even bothered to comment it ;-) It will show selected item[s]

Somebody will no doubt post improvements.

<?php
/* formDropDown - create an HTML <SELECT>
* vars: $name - the form variable NAME
*       $value - the SELECTED option which may be an array for multiple 
selected items
*       $labels - assoc. array, list of values=>labels
*        $multiple - if non-empty, select multiple
*        $size - number of rows to show if multiple
* returns: string, HTML (i.e. for use in echo or print statement) */

function formDropDown($name,$value,$labels,$multiple = '',$size ='') {
  $html = '<SELECT NAME="' .$name . '"';
        if(!empty($multiple)) {
                $html .= ' MULTIPLE';
        }
        if(!empty($size)) {
                $html .= ' SIZE=' . $size;
        }
        
  $html .= ">\n";
  $key = key($labels);
  while($key != "") {
        /* Check if the current value is in the $value variable */
        if(is_array($value)) {
          if(in_array($key,$value)) {
        $selected = ' SELECTED';
      } else {
        $selected = '';
      }
        } else {
      if ($key == $value) {
        $selected = ' SELECTED';
      } else {
        $selected = '';
      }
        }
    $html .= "<OPTION VALUE=\"$key\"$selected>$labels[$key]\n";
    next($labels);
    $key = key($labels);
  }
  $html .= "</SELECT>\n";
  return $html;
}
?>




How do I store (and update) an array within a session...

Like I'd have

<?php
        session_start();
        $time["page1"]="20";

        //here, should I do this?
        session_register("time["page1"]");

        //or this?
        session_register("time");

?>

cuz I'll have more pages...
        $time["page20"]="300";

is this going to automatically load into the session vars or I have to do 
something first?
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





"Christian Dechery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How do I store (and update) an array within a session...
>
> Like I'd have
>
> <?php
> session_start();
> $time["page1"]="20";
>
> //here, should I do this?
> session_register("time["page1"]");
>
> //or this?
> session_register("time");

It should work with this.

FYI. If you set register globals off and enable track vars on in your php.ini.
(It may work with other settings, but this is what I use)You don't even have to
write

$var = "session var";
session_register("var");
session_unregister("var");

 Instead, you can write

$HTTP_SESSION_VARS['var'] = "value you want to store in session";
unset($HTTP_SESSION_VARS['var']); // to unregister from session

>
> ?>
>
> cuz I'll have more pages...
> $time["page20"]="300";
>
> is this going to automatically load into the session vars or I have to do
> something first?

No.

When I learn new languages, I usually write a lot of simple codes to make sure I
correctly understands how it works. I suggest to do that.

Regards,
--
Yasuo Ohgaki






On Tue, 27 Mar 2001 18:48, Daniel B I wrote:
> It.s me, again :)
> There is trick to find out if php will be compiled well
> (I mean with jpeg support):
>
> when issuing the ./configure command in php,
> after putting all the options, put something like this:
> ./configure ... > cf.log
>
> (this is a redirection comand to write all output info
> to the file named cf.log so that you could review it
> afterwards. excuse me if you knew it :)
>
> in this way you can examine after the configuration
> process what was done (it does it so quickly that I
> cannot see all it does, so this way I can).
> If all is ok, you should see in that log something like:
>
> .....ImageCreateFromJpeg:  yes
>
> If it says no, don't bother yourself by issuing the make
> and make install commands. review the previous jpeg
> and gd installations and try again.
>
> Daniel BI

You can also check the log that PHP creates as configure is run: 
config.log in the top level of the unpacked distribution.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




On Tue, 27 Mar 2001 18:48, Jochen Kaechelin wrote:
> how can I connect to a remote-database from
> my local dos-window?
>
> I use the following without success:
>
> mysql -u XXXXXXX -h mysql-XXXXXXX -p -D XXXX
>
>
> Jochen Kaechelin

Should you not have a full hostname as the argument for -h ?

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




I'm attempting to write a chat which streams HTML. There's a problem with the 
main function that's responsible for 'streaming'. It loops endlessly and if 
anytihng new appears in the database, it parses it into HTML and outputs it 
via the echo command. The chatboxDisplay method is what is responsible for 
parsing and echoing the message and the HTML for it. This is the problem 
code. The code is syntactically correct; it runs, in fact, if you remove the 
while stuff, it DOES work, except for the fact that it doesn't 'stream' like 
it should (Because it's not looping. It fires the output and the script 
ends). So when I put the while brackets back on to make it 'stream', there's 
no output. (as in, in netscape 4.7x it doesn't send much anything. the screen 
remains grey and just perpetually loads nothing) Any ideas as to what the 
heck is going on?

Thanks.

-------

while (1) {

        $posts=mysql_query("SELECT * FROM chat ORDER BY date DESC;") or die 
("Query failed line 111");
        $data=mysql_fetch_array($posts);

                while ($data=mysql_fetch_array($posts)) {
                chatboxDisplay($data);
                if ($data[id] > $id) { $id = $data[id]; }
                }


flush();
sleep(2);


        } 








you can't stream output like that.......netscape will wait until your
HTML output is done, but if you're infinitely looping, it won't be, and
you'll never get your </body></html> tags.....i've seen a number of
posts trying to do chats and flush() the output, but bottom line, if you
don't send it a complete html file, it won't be happy.....one
suggestion: you could try sending a complete file, then refreshing it
every few seconds.....but, there would be better ways to do this (like
java)

-jack

"Sean B." wrote:
> 
> I'm attempting to write a chat which streams HTML. There's a problem with the
> main function that's responsible for 'streaming'. It loops endlessly and if
> anytihng new appears in the database, it parses it into HTML and outputs it
> via the echo command. The chatboxDisplay method is what is responsible for
> parsing and echoing the message and the HTML for it. This is the problem
> code. The code is syntactically correct; it runs, in fact, if you remove the
> while stuff, it DOES work, except for the fact that it doesn't 'stream' like
> it should (Because it's not looping. It fires the output and the script
> ends). So when I put the while brackets back on to make it 'stream', there's
> no output. (as in, in netscape 4.7x it doesn't send much anything. the screen
> remains grey and just perpetually loads nothing) Any ideas as to what the
> heck is going on?
> 
> Thanks.
> 
> -------
> 
> while (1) {
> 
>         $posts=mysql_query("SELECT * FROM chat ORDER BY date DESC;") or die
> ("Query failed line 111");
>         $data=mysql_fetch_array($posts);
> 
>                 while ($data=mysql_fetch_array($posts)) {
>                 chatboxDisplay($data);
>                 if ($data[id] > $id) { $id = $data[id]; }
>                 }
> 
> flush();
> sleep(2);
> 
>         }
> 
> --
> 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]




> you can't stream output like that.......netscape will wait until your
> HTML output is done, but if you're infinitely looping, it won't be, and
> you'll never get your </body></html> tags.....i've seen a number of
> posts trying to do chats and flush() the output, but bottom line, if you
> don't send it a complete html file, it won't be happy.....one
> suggestion: you could try sending a complete file, then refreshing it
> every few seconds.....but, there would be better ways to do this (like
> java)

Netscape will not neccessarily wait for </BODY> and </HTML>, but it
won't layout a table until it hits a </TABLE>. If the output's all in
a table, this'd cause it. You should also ensure that any <IMG> tags 
have WIDTH="" and HEIGHT="" attributes set appropriately as it can 
increase layout time otherwise.

Jason




Thanks, that did it.

Steve
----- Original Message ----- 
From: "David Robley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 7:58 PM
Subject: Re: [PHP] setting Check box


> On Wed, 28 Mar 2001 10:18, S. Efurd wrote:
> > This worked for me as well, and helped me with a problem I was having!
> >
> > How would you show what option was selected in a drop down box. I have
> > a form the user fills out, this goes to a confirmation page to ensure
> > the data enetered is correct. I have a drop down box for states, and I
> > cant seem to make it show the state selected it always defaults to
> > first choice?
> >
> > Thanks
> 
> I've built a function for displaying drop down lists: yours for free. Oh 
> look, Ive even bothered to comment it ;-) It will show selected item[s]
> 
> Somebody will no doubt post improvements.
> 
> <?php
> /* formDropDown - create an HTML <SELECT>
> * vars: $name - the form variable NAME
> *       $value - the SELECTED option which may be an array for multiple 
> selected items
> *       $labels - assoc. array, list of values=>labels
> * $multiple - if non-empty, select multiple
> * $size - number of rows to show if multiple
> * returns: string, HTML (i.e. for use in echo or print statement) */
> 
> function formDropDown($name,$value,$labels,$multiple = '',$size ='') {
>   $html = '<SELECT NAME="' .$name . '"';
> if(!empty($multiple)) {
> $html .= ' MULTIPLE';
> }
> if(!empty($size)) {
> $html .= ' SIZE=' . $size;
> }
> 
>   $html .= ">\n";
>   $key = key($labels);
>   while($key != "") {
>   /* Check if the current value is in the $value variable */
> if(is_array($value)) {
>     if(in_array($key,$value)) {
>     $selected = ' SELECTED';
>       } else {
>     $selected = '';
>       }
> } else {
>       if ($key == $value) {
>     $selected = ' SELECTED';
>       } else {
>     $selected = '';
>       }
> }
>     $html .= "<OPTION VALUE=\"$key\"$selected>$labels[$key]\n";
>     next($labels);
>     $key = key($labels);
>   }
>   $html .= "</SELECT>\n";
>   return $html;
> }
> ?>
> 
> -- 
> 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]
> 
> 





I've an interesting problem that after using php to restart SAMBA the server
no longer parses php to that particular browser.

This is really really weird!!

The situation is that I've built a php tool to restart server services such
as atalk and samba. Starting/Restarting/Stopping atalk works beautifully
however, restarting SAMBA kills something???

the PHP I'm using to do the restart is:

$test = shell_exec("/etc/rc.d/init.d/smb restart &");
echo "<br>test: $test<br>";
echo "<br>samba restarted";

I've tried with and without the "&" to run it as a background process.
I've tried with shell_exec and exec commands.
I even tried writing a script which does the restart and just get PHP to run
the script.

none were successful.

$test echoes out exactly what it should when restarting SAMBA ie. shutting
down details and then start up details.

I've even tried using "exit()" after my script and it still won't work.

what it does it that after I run the page with the script I can no longer
load pages served from that particular server with php content on them. So I
can still view plain html pages after running the script. Weirder still, PHP
has not crashed because I can pull up another browser from the same computer
and view everything fine. When trying to access the php pages basically the
browser keeps spinning away and eventually times out.

To get the browser to access php content pages on this server I have to quit
and restart my browser.

madness!!!

It's like php just refuses to allow connections from that browser after this
command is run???

I've no idea where to begin trouble shooting this one. I've tried everything
I can think of and I'm out of ideas. So if anyone could help me with this it
would be fantastic!!!

-Tim Churchward






I've noticed there isn't really a jumping off point for the PHP-GTK beginners
and users. I spent the last few hours throwing a site together that has the
basics to fill this void.

It has:

1.) An application archive
2.) News 
3.) Discussion
4.) Helpful Links

I've put up one of my initial apps and plan to put up a few others and maybe
a small HOWTO. I'd like the people who have been posting apps to take a few 
minutes to post their apps here as well. Also, anyone who was thinking of 
posting their apps it might be better served if we posted them in a more
central location. Finally, if anyone wants to help out (admin, howtos, etc.)
please feel free to contact me. 

As for me, I'm tired and plan on working on it more tomarrow :o)

--Joe


/*****************************\
 *    Joe Stump              *
 *    www.Care2.com          *   
 *    Office: 650.328.0198   *
 *    Extension: 122         *
\*****************************/
        www.miester.org

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12 
GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
------END GEEK CODE BLOCK------





So tired I forgot to put in the URL:

http://gtk.php-coder.net

--Joe

On Tue, Mar 27, 2001 at 10:32:26PM -0500, Joe Stump wrote:
> I've noticed there isn't really a jumping off point for the PHP-GTK beginners
> and users. I spent the last few hours throwing a site together that has the
> basics to fill this void.
> 
> It has:
> 
> 1.) An application archive
> 2.) News 
> 3.) Discussion
> 4.) Helpful Links
> 
> I've put up one of my initial apps and plan to put up a few others and maybe
> a small HOWTO. I'd like the people who have been posting apps to take a few 
> minutes to post their apps here as well. Also, anyone who was thinking of 
> posting their apps it might be better served if we posted them in a more
> central location. Finally, if anyone wants to help out (admin, howtos, etc.)
> please feel free to contact me. 
> 
> As for me, I'm tired and plan on working on it more tomarrow :o)
> 
> --Joe
> 
> 
> /*****************************\
>  *    Joe Stump              *
>  *    www.Care2.com          *   
>  *    Office: 650.328.0198   *
>  *    Extension: 122         *
> \*****************************/
>         www.miester.org
> 
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.12 
> GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
> N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
> 5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
> ------END GEEK CODE BLOCK------
> 
> 
> -- 
> PHP GTK 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]
/*****************************\
 *    Joe Stump              *
 *    www.Care2.com          *   
 *    Office: 650.328.0198   *
 *    Extension: 122         *
\*****************************/
        www.miester.org

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12 
GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
------END GEEK CODE BLOCK------





On Wednesday 28 March 2001 04:32, Joe Stump wrote:
> I've noticed there isn't really a jumping off point for the PHP-GTK
> beginners and users. 

Thanks for doing that. 

I'm PHP developer and I've been following this list for a while and I've been 
looking around for a good place to start on PHP-GTK and not finding it.

Cheers,

-- 
Richard Watson




I got a question here. How would you go about calling variables from a form. I'm sure 
this is super-easy, but I'm a newbie. Any help would be greatly appreciated.




The input type name is the variable so say you have 

<input type="text" name="foo">   your variable = $foo

Peter

-----Original Message-----
From: chris herring [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 2:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Blah I'm Stupid


I got a question here. How would you go about calling variables from a form. I'm sure 
this is super-easy, but I'm a newbie. Any help would be greatly appreciated.




On Wed, 28 Mar 2001 13:44, chris herring wrote:

> > I got a question here. How would you go about calling variables from a
> form. I'm sure this is super-easy, but I'm a newbie. Any help would be
> greatly appreciated.

Just prefix the form object names with $

Say you have a text box set up like so:

<FORM ACTION=check.php METHOD=GET>
<input type="text" name="avail" value="">
<INPUT TYPE=SUBMIT>
</FORM>

and in check.php

<?php echo $avail; ?>

will show the value entered in the text box

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




how would you go about writing that data do a text file then?
----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: "chris herring" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 10:19 PM
Subject: Re: [PHP] Blah I'm Stupid


> On Wed, 28 Mar 2001 13:44, chris herring wrote:
>
> > > I got a question here. How would you go about calling variables from a
> > form. I'm sure this is super-easy, but I'm a newbie. Any help would be
> > greatly appreciated.
>
> Just prefix the form object names with $
>
> Say you have a text box set up like so:
>
> <FORM ACTION=check.php METHOD=GET>
> <input type="text" name="avail" value="">
> <INPUT TYPE=SUBMIT>
> </FORM>
>
> and in check.php
>
> <?php echo $avail; ?>
>
> will show the value entered in the text box
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> 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]





On Wed, 28 Mar 2001 14:31, chris herring wrote:
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: "chris herring" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, March 27, 2001 10:19 PM
> Subject: Re: [PHP] Blah I'm Stupid
>
> > On Wed, 28 Mar 2001 13:44, chris herring wrote:
> > > > I got a question here. How would you go about calling variables
> > > > from a
> > >
> > > form. I'm sure this is super-easy, but I'm a newbie. Any help would
> > > be greatly appreciated.
> >
> > Just prefix the form object names with $
> >
> > Say you have a text box set up like so:
> >
> > <FORM ACTION=check.php METHOD=GET>
> > <input type="text" name="avail" value="">
> > <INPUT TYPE=SUBMIT>
> > </FORM>
> >
> > and in check.php
> >
> > <?php echo $avail; ?>
> >
> > will show the value entered in the text box

> how would you go about writing that data do a text file then?

File system functions. fopen the file you want to put the data in, fwrite 
the values from the variable(s) to the file and fclose the file at the 
end of the process.

Note the ways you can open a file with fopen; and be aware of file 
permission problems because this is done as the user the web server runs 
as (*nix, dunno about windows).

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




ok here's the script i have, and i keep getting errors

<?
$fp = fopen("file.txt", "w");
$fp = fputs("file.txt", "<a href=\"$url\">$text</a><br>", "r+");
$fp = fclose("file.txt");

echo "<form method=\"post\" action=\"$fp\">";
echo "<input type=\"text\" name=\"url\" size=\"20\" value=\"http://\">";
echo "<input type=\"text\" name=\"text\" size=\"20\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Generate New Link\">";

echo "</form>";
?>

what's wrong with it. it says it's with the fputs and fclose things.
----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: "chris herring" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 11:06 PM
Subject: Re: [PHP] Blah I'm Stupid


> On Wed, 28 Mar 2001 14:31, chris herring wrote:
> > ----- Original Message -----
> > From: "David Robley" <[EMAIL PROTECTED]>
> > To: "chris herring" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Tuesday, March 27, 2001 10:19 PM
> > Subject: Re: [PHP] Blah I'm Stupid
> >
> > > On Wed, 28 Mar 2001 13:44, chris herring wrote:
> > > > > I got a question here. How would you go about calling variables
> > > > > from a
> > > >
> > > > form. I'm sure this is super-easy, but I'm a newbie. Any help would
> > > > be greatly appreciated.
> > >
> > > Just prefix the form object names with $
> > >
> > > Say you have a text box set up like so:
> > >
> > > <FORM ACTION=check.php METHOD=GET>
> > > <input type="text" name="avail" value="">
> > > <INPUT TYPE=SUBMIT>
> > > </FORM>
> > >
> > > and in check.php
> > >
> > > <?php echo $avail; ?>
> > >
> > > will show the value entered in the text box
>
> > how would you go about writing that data do a text file then?
>
> File system functions. fopen the file you want to put the data in, fwrite
> the values from the variable(s) to the file and fclose the file at the
> end of the process.
>
> Note the ways you can open a file with fopen; and be aware of file
> permission problems because this is done as the user the web server runs
> as (*nix, dunno about windows).
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA





How to send attachment with email with php?




On Wed, 28 Mar 2001 14:47, chris herring wrote:
> ok here's the script i have, and i keep getting errors
>
> <?
> $fp = fopen("file.txt", "w");
> $fp = fputs("file.txt", "<a href=\"$url\">$text</a><br>", "r+");
> $fp = fclose("file.txt");
>
> echo "<form method=\"post\" action=\"$fp\">";
> echo "<input type=\"text\" name=\"url\" size=\"20\"
> value=\"http://\">"; echo "<input type=\"text\" name=\"text\"
> size=\"20\">";
> echo "<input type=\"submit\" name=\"submit\" value=\"Generate New
> Link\">";
>
> echo "</form>";
> ?>
>
> what's wrong with it. it says it's with the fputs and fclose things.

It would, I suppose, even without seeing the actual errors. fputs and 
fwrite want a file pointer, ie the value returned by fopen, as the first 
argument. And if there is a third argument, it should be the number of 
bytes to be written, not something that looks like a fopen mode :-) 
fclose also wants a file pointer not a name.

$fp = fopen("file.txt", "w");
$result = fputs($fp, "<a href=\"$url\">$text</a><br>");
fclose($fp);

You probably don't need the $result in the second line, but if you 
wanted, you could use it to confirm writing of stuff before closing or 
whatever.

You could use single quotes to delimit the string you are writing; then 
you wouldn't need to escape the double quotes - in the example you show.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Hi,

I am curious to know why you need to use the /n, and what it actually does,
because I had a page that used them, and i removed them all and it still
works fine.

Also, is it seen as good or bad practive to use \" only when required or all
the time.
i.e
echo "<img src=test.gif>"; //Doesn't need to use \"
echo "<img src=test.gif alt=\"Test Image\">"; //Only need to use it on the
alt text.

Just curious, and also keen to learn this with the good practice method.

--
Regards,


YoBro
-------------------------------------------------------------
DO NOT REPLY TO THIS VIA EMAIL
PLEASE USE THE NEWSGROUP
All emails sent to this address are automatically deleted.
This is to avoid SPAM!
-------------------------------------------------------------






At 06:04 PM 28/03/2001, you wrote:
>Hi,
>
>I am curious to know why you need to use the /n, and what it actually does,
>because I had a page that used them, and i removed them all and it still
>works fine.

As far as the HTML output, it wont affect how it shows up on the screen, 
but if you look at the HTML code, you will notice everything is on 1 
big-ass long line.

Using a /n at the end of an echo or print statement will put a carriage 
return at the end so your HTML code is more pleasant to view and makes it 
alot easier to view when you are trying to work out any problems in HTML 
layouts.


>Also, is it seen as good or bad practive to use \" only when required or all
>the time.


My general rule of thumb is to use \" whenever I need a "

in general, I avoid using quotes where possible (such as in the following)
<font size=3 face=Arial> (instead of <font size=\"3\" face=\"Arial\">)

But for things like ALT tags, I use \" because spaces are required in the 
value of the ALT tag.



Chris




--
       Chris Aitken - Webmaster/Database Designer - IDEAL Internet
email: [EMAIL PROTECTED]  phone: +61 2 4628 8888  fax: +61 2 4628 8890
             --------------------------------------------

       Unix -- because a computer's a terrible thing to waste!






> I am curious to know why you need to use the /n, and what it actually does,
> because I had a page that used them, and i removed them all and it still
> works fine.

Have a look here (the main manual is down this second) :
  http://uk.php.net/manual/en/language.types.string.php

An example use is as follows :

    <?php
        echo "<table>\n";
        echo "\t<tr>\n";
        echo "\t\t<td>hi</td>\n";
        echo "\t</tr>";
        echo "</table>\n";
    ?>

The HTML source will look like :

    <table>
        <tr>
            <td>hi</td>
        </tr>
    </table>

But if NO \n's or \t's were used, the HTML source would have looked like :

    <table><tr><td>hi</td></tr></table>

It makes for pretty HTML source huh?  Granted with the above example
we'd write it as plain HTML but it's an example :)  Also such whitespace
is important when sending mail.   Also, some related information exists
around here :

    http://www.php.net/manual/en/function.nl2br.php

> Also, is it seen as good or bad practive to use \" only when required or all
> the time.
> i.e
> echo "<img src=test.gif>"; //Doesn't need to use \"
> echo "<img src=test.gif alt=\"Test Image\">"; //Only need to use it on the
> alt text.

Escape quotes as you need them.  In the above case I'd probably either
just write it as HTML or do this :

    echo '<img src="test.gif" alt="Test Image">';

Single quotes can be in double, double can be in single.  In this case
single quotes are better as PHP doesn't have to interpet anything within
single quotes, they're faster!  Check out this tutorial for useful advice
on using strings (and quotes) :

    http://www.zend.com/zend/tut/using-strings.php

Regards,

Philip






> >I am curious to know why you need to use the /n, and what it actually
does,
> >because I had a page that used them, and i removed them all and it still
> >works fine.
>
> As far as the HTML output, it wont affect how it shows up on the screen,
> but if you look at the HTML code, you will notice everything is on 1
> big-ass long line.
>
> Using a /n at the end of an echo or print statement will put a carriage
> return at the end so your HTML code is more pleasant to view and makes it
> alot easier to view when you are trying to work out any problems in HTML
> layouts.

Umm, it's a newline, and it should  be used as \n (not /n).  It's a C style
escape for the new-line character.  I beleive using \r will insert a
carrige-return.   Anyway, same sort of difference (depending on the
editor).. puts the following text on the next line...

NOTE:  *nix text files just use a Newline at the end of each line.  DOS
(windows) files use a \r\n pair at the end of each line (Carrige-return,
line feed).  To make sense of this, think of a type writer or an old
dot-matrix printer..  carrige return: you've moved the print head back to
the left.. newline/linefeed, rolled through one line.

> >Also, is it seen as good or bad practive to use \" only when required or
all
> >the time.
>
> My general rule of thumb is to use \" whenever I need a "
>
> in general, I avoid using quotes where possible (such as in the following)
> <font size=3 face=Arial> (instead of <font size=\"3\" face=\"Arial\">)
>
> But for things like ALT tags, I use \" because spaces are required in the
> value of the ALT tag.


Lets show an example:

    echo "This is a string";

would print out:

        This is a string

however:

    echo "This is a "string"";

would spit out a pasing error.  The quoted string (") ends at:

        This is a

however, 'string' and the following "'s would not encasing anything.

Rule of thumb:  If you are using double quotes to enclose a string, but you
want double quotes within as well, use \" (called escaping).  Same goes for
the $ symbol.  within quotes, if you want the symbol to show up, use \$.
Otherwise, it'd try to evaluate it as variable!

This is all documented err, somewhere *digs though manuals*, but strangely
enough I can't find it :-|

hope this helps.

bkx






Hello,

* i am new to linux environment, where can i get IMAP installation guide
* where to get a proper IMAP software

--
--------------------------------------------------------------
Any suggestions would be appreciated.
Thank You

Khai Mun, Ng






Hello,

* i wondering where to get ifo on developing web e-mail
* what standard should i use to deveping to software

--
--------------------------------------------------------------
Any suggestions would be appreciated.
Thank You

Khai Mun, Ng






I'm facing a problem with Special Characters ($, %, &,
\, /, ;, :, ", ') etc......
We are sending a varibale in a query string like this
:

<a href="add_pro_team.php3?title=<? echo
urlencode($title) ?>">

with $title containing multiple words & these special
characters, it is not passed. I get an error. 

Without urlencode, multiple words are not passed with
the "+" signs. And with URLENCODE, the special
characters are not processes giving an error? what do
i do? 

Also, if someone enters any of these special
characters in text areas or fields provided to them -
and they have to be entered into the database - the
entering is done successfully, but getting values back
from database to print on the page gives an error. How
to work through these special characters in a way that
they can be entered & extracted back from database &
also passed in query strings as is without errors??

Regards,
T. Edison jr.

=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text




Dear Khai,

If you're planning to your webmailapplication in PHP visit www.phpposta.com. 
Right now it's in a developing stage but you can download the code and have a look
at it. Ofcourse it's GPL, if you make some additions, changes in the code please let 
me know!

Best regards,
Maarten Verheijen


>>> "Szeto" <[EMAIL PROTECTED]> 28-03-01 07:23 >>>
Hello,

* i wondering where to get ifo on developing web e-mail
* what standard should i use to deveping to software

--
--------------------------------------------------------------
Any suggestions would be appreciated.
Thank You

Khai Mun, Ng



-- 
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] 






Hello,

can i make a function that displays the __LINE__ of it's caller?

ie:

function show_caller_s_line()
{
   echo "my caller's line is:" . __LINE__;
}

1: blahblahblah
2: show_caller_s_line()
3: blahblah

output should be:
  my caller's line is: 3


is that possible?

thanks.
-elias






Hey all,

I know you do not want to hear this question but after reading the list 
archives and doing extensive searches with google I have a really large 
internet headache, so here we go:

Where do I get a browscap.ini file that is current and will work in Linux?

The one suggested in the manual doesn't seem do work properly, it only 
outputs 2 lines under ie5.5:

browser_name_pattern: blah blah
parent: gobbely gook ascii

I found another but it parse errors for no apparent reason.

What is the deal? Any tips regarding detecting browser capabilties would 
be great (mainly js and cookies)

Any help always appreciated,

Regards,

Joseph




Reply via email to