php-general Digest 2 Feb 2003 13:09:31 -0000 Issue 1859

Topics (messages 133941 through 133989):

Re: Screen Size detect??
        133941 by: Martin

Re: using <input> tags with php
        133942 by: Philip Olson
        133956 by: Sunfire
        133967 by: David Freeman
        133971 by: David Freeman
        133982 by: Edwin Boersma

Re: Loading CSV data into MySQL
        133943 by: John W. Holmes
        133954 by: Jason Sheets
        133980 by: Edwin Boersma

emulate callback error for php3
        133944 by: electroteque
        133962 by: electroteque

Re: Register globals on and off
        133945 by: Pat Johnston
        133973 by: Philip Olson

Re: Passing Variables
        133946 by: Beauford.2002

Re: PHP.ini help on Linux
        133947 by: Michael Mauch
        133966 by: Nicole
        133968 by: Nicole

Re: 4.3 Install on Solaris
        133948 by: J Smith
        133950 by: Dan Lowe

Base64 Encode
        133949 by: Stephen
        133970 by: Evan Nemerson

Using SELECT and MULTIPLE in a form
        133951 by: James Kaufman
        133952 by: John Nichel
        133953 by: Tom Rogers

Line Number function?
        133955 by: Benjamin Smith
        133957 by: Steven Balthazor
        133969 by: Michael Sims
        133975 by: Philip Olson

Turn off PHP for certain directories?
        133958 by: Benjamin Smith
        133960 by: Timothy Hitchens \(HiTCHO\)
        133985 by: Tom Rogers
        133989 by: Ernest E Vogelsinger

php and Mac running 8.6
        133959 by: Bobbi-Lea
        133961 by: Timothy Hitchens \(HiTCHO\)
        133979 by: Justin French

help with script!!!
        133963 by: Karl James
        133972 by: Hugh Danaher
        133974 by: Philip Olson
        133976 by: David Freeman
        133977 by: Philip Olson

.dat file
        133964 by: Karl James

perl regex help
        133965 by: Alex

Re: any change to see php source?
        133978 by: qt
        133983 by: Edwin Boersma

Trouble with Exec
        133981 by: Nicole

Re: help needed building query string based on which form fields that are filled.
        133984 by: Edwin Boersma

Retrieving field name of Database
        133986 by: Davy Obdam

processing form with unknown number of checkboxes, each with a unknown name.
        133987 by: anders thoresson
        133988 by: Tim Ward

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
you can create a form with hidden fields like this

 <script language="JavaScript">

    document.screendata.height.value=screen.height;
    document.screendata.width.value=screen.width;
    screendata.submit();
</script>

<form method="post" action="index.php" name="screendata">
<input type="hidden" name="height">
<input type="hidden" name="width">
</form>

bye

"Nigel Powell" <[EMAIL PROTECTED]> escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On a slight side note to this, how can you pass javascript variables to
> PHP via POST?
>
> Newbie Powell
>
> On Saturday, February 1, 2003, at 12:21 PM,
> [EMAIL PROTECTED] wrote:
>
> > From: "Sean Malloy" <[EMAIL PROTECTED]>
> > Date: Sat Feb 1, 2003  6:48:26 AM Europe/London
> > To: "Dade Register" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> > Subject: RE: [PHP] Screen Size detect??
> >
> >
> > Create index.htm;
> >
> > <script language="JavaScript">
> > var width  = screen.width;
> > var height = screen.height;
> > window.location = 'index.php?width=' + width + '&height=' + height;
> > </script>
> >
> > and in index.php
> >
> > $width = $_GET['width'];
> > $height = $_GET['height'];
> >
> >
> > etc etc
>


--- End Message ---
--- Begin Message ---
On Sat, 1 Feb 2003, Sunfire wrote:

> hi.. i took your idea...
> i put the error reporting code at the top of the script and ran it as the
> problem was still there to see what would happen.. instead i get 0 messages
> from the reporting system and all i get is the last 7 chars of the print
> line and the }?> at the end of the script... so for instance if i do:
> print("<input type=\"text\" name=\"company\" value=$new['company']\n");
> or any variance of that statement changing around the \" and apostrophes
> around to try different things all i get is the rest of the script starting
> from the \n all the way to the rest of the script where it says }?> at the
> end dont know if this is a bug or not but its getting hard to figure out
> what the problem with my echo or print statements are...
> here is the whole script:
> its supposed to get all fields and then display in input text boxes the
> current values in that certain record  i know i missed some stuff in it with
> the query but at this point was supposed to be a test to see if i could even
> put it in the box in the first place... but here is the code:

Please step back, slow down, and write your question
in a short concise format.  I have no clue what the
above means.

> <html>
> <head>
> <title>edit member</title>
> 
> </head>
> 
> <form action=edit1.php method=post>
> pick some of these:<br>
> <?php
> error_reporting(E_ALL);
> mysql_connect("192.4.5.6", "root", "");
> mysql_select_db("wata");
> $result=mysql_query("select * from members where company like 'test'");
> while($row=mysql_fetch_array($result)){
> print("<input type=text name=company value=\"$row[company\"]>\n\n");

// Try this instead, see also: htmlspecialchars()*
print "<input type='text' name='company' value='{$row['company']}'>";

Regards,
Philip

* http://www.php.net/manual/en/faq.html.php#faq.html.encoding


> }
> ?>
> <input type="submit" value="send">
> </form>
> </html>
> 
> /*end*/
> any changes to make it work would be appreciated...tnx
> 
> 
> ----- Original Message -----
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "Sunfire" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, February 01, 2003 6:48 PM
> Subject: Re: [PHP] using <input> tags with php (IMPORTANT READ)
> 
> 
> >
> > On Sat, 1 Feb 2003, Sunfire wrote:
> >
> > > if i do this:
> > > /*all the mysql login stuff here*/
> > >
> > > $query=mysql_query("select * from members");
> > > while($new=mysql_fetch_array($query)){
> > > echo "$new['company']";
> > > /*so on through the field list*/
> > > }
> > > on output all i get is the title with a submit button..
> > > otherwise blank..
> >
> >   There is a bug in PHP 4.3.0 regarding the use of arrays
> >   in strings.  The following gave a parse error before
> >   PHP 4.3.0:
> >
> >     print "Do not do this: $arr['key']";
> >
> >   Now it gives an E_NOTICE error due to changes to the string
> >   scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
> >   and instead it will work (no parse error either).  Surrounding
> >   the array with {braces} in the string works regardless, so:
> >
> >     print "You can do this: {$arr['key']}";
> >
> >   Regarding this question, don't write it like that but instead
> >   do the following (no quotes needed):
> >
> >     echo $new['company'];
> >
> >   For those wondering about this bug, see:
> >
> >     http://bugs.php.net/bug.php?id=21820
> >
> >   The string documentation has been updated to demonstrate
> >   the array in string phenomena (except the bug hasn't been
> >   mentioned as I'm waiting for it to be committed first).
> >
> >     http://www.php.net/types.string
> >
> >   Sunfire, you aren't seeing this E_NOTICE error because your
> >   error level is turned down (by default).  Put this on top
> >   of your script to see them all:
> >
> >     error_reporting(E_ALL);
> >
> >   Regards,
> >   Philip
> >
> >
> > > same thing with fetch_object()...and i have 1 row in the members
> table..im
> > > sort of confused now that it doesnt work for a wierd reason
> > >
> > > any better ideas on how to get the stuff out of the table and into vars?
> > > maybe im doing it wrong
> > >
> > >
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Saturday, February 01, 2003 5:33 PM
> > > Subject: Re: [PHP] using <input> tags with php
> > >
> > >
> > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
> > > > [EMAIL PROTECTED] writes:
> > > >
> > > > >i tried getting the values into vars using fetch_array/fetch_object
> and
> > > > >fetch_row and tried to put them in variables but for some odd reason
> it
> > > > >really doesnt work because when i try to use the vars in the value
> > > section
> > > > >instead of printing in the edit box the content of the variable i
> usually
> > > > >end up with "?>", ">", "<?php", or "}?>" instead... any reason this
> shows
> > > > >up? and when i do:
> > > > >echo "<input type=text name=$name value='$new_var'>";
> > > > >then on the web page i end up with some thing like this instead of
> the
> > > edit
> > > > >box:
> > > > >">";;">
> > > > >}?>
> > > > >any reason for that?
> > > >
> > > > It sounds like $name and/or $new_var may be empty. Did you echo the
> > > variables
> > > > before using them in your form to check whether the values from the
> > > database
> > > > are actually in the variables?
> > > >
> > > > Janet
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
ok let me try this question thing again...

i am having a problem using <input> tags by using current values kept in a
mysql table. how do you get the values out of the table and into a form so
they show as the value= part of the tag?
i tried just aabout everything and it doesnt work even htmlspecialchars()
doesnt work.. all i get for output on the page is the rest of the script
printed on the screen after the value= part of the tag..is there any way to
fix it?


----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Sunfire" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 8:01 PM
Subject: Re: [PHP] using <input> tags with php


> On Sat, 1 Feb 2003, Sunfire wrote:
>
> > hi.. i took your idea...
> > i put the error reporting code at the top of the script and ran it as
the
> > problem was still there to see what would happen.. instead i get 0
messages
> > from the reporting system and all i get is the last 7 chars of the print
> > line and the }?> at the end of the script... so for instance if i do:
> > print("<input type=\"text\" name=\"company\" value=$new['company']\n");
> > or any variance of that statement changing around the \" and apostrophes
> > around to try different things all i get is the rest of the script
starting
> > from the \n all the way to the rest of the script where it says }?> at
the
> > end dont know if this is a bug or not but its getting hard to figure out
> > what the problem with my echo or print statements are...
> > here is the whole script:
> > its supposed to get all fields and then display in input text boxes the
> > current values in that certain record  i know i missed some stuff in it
with
> > the query but at this point was supposed to be a test to see if i could
even
> > put it in the box in the first place... but here is the code:
>
> Please step back, slow down, and write your question
> in a short concise format.  I have no clue what the
> above means.
>
> > <html>
> > <head>
> > <title>edit member</title>
> >
> > </head>
> >
> > <form action=edit1.php method=post>
> > pick some of these:<br>
> > <?php
> > error_reporting(E_ALL);
> > mysql_connect("192.4.5.6", "root", "");
> > mysql_select_db("wata");
> > $result=mysql_query("select * from members where company like 'test'");
> > while($row=mysql_fetch_array($result)){
> > print("<input type=text name=company value=\"$row[company\"]>\n\n");
>
> // Try this instead, see also: htmlspecialchars()*
> print "<input type='text' name='company' value='{$row['company']}'>";
>
> Regards,
> Philip
>
> * http://www.php.net/manual/en/faq.html.php#faq.html.encoding
>
>
> > }
> > ?>
> > <input type="submit" value="send">
> > </form>
> > </html>
> >
> > /*end*/
> > any changes to make it work would be appreciated...tnx
> >
> >
> > ----- Original Message -----
> > From: "Philip Olson" <[EMAIL PROTECTED]>
> > To: "Sunfire" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Saturday, February 01, 2003 6:48 PM
> > Subject: Re: [PHP] using <input> tags with php (IMPORTANT READ)
> >
> >
> > >
> > > On Sat, 1 Feb 2003, Sunfire wrote:
> > >
> > > > if i do this:
> > > > /*all the mysql login stuff here*/
> > > >
> > > > $query=mysql_query("select * from members");
> > > > while($new=mysql_fetch_array($query)){
> > > > echo "$new['company']";
> > > > /*so on through the field list*/
> > > > }
> > > > on output all i get is the title with a submit button..
> > > > otherwise blank..
> > >
> > >   There is a bug in PHP 4.3.0 regarding the use of arrays
> > >   in strings.  The following gave a parse error before
> > >   PHP 4.3.0:
> > >
> > >     print "Do not do this: $arr['key']";
> > >
> > >   Now it gives an E_NOTICE error due to changes to the string
> > >   scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
> > >   and instead it will work (no parse error either).  Surrounding
> > >   the array with {braces} in the string works regardless, so:
> > >
> > >     print "You can do this: {$arr['key']}";
> > >
> > >   Regarding this question, don't write it like that but instead
> > >   do the following (no quotes needed):
> > >
> > >     echo $new['company'];
> > >
> > >   For those wondering about this bug, see:
> > >
> > >     http://bugs.php.net/bug.php?id=21820
> > >
> > >   The string documentation has been updated to demonstrate
> > >   the array in string phenomena (except the bug hasn't been
> > >   mentioned as I'm waiting for it to be committed first).
> > >
> > >     http://www.php.net/types.string
> > >
> > >   Sunfire, you aren't seeing this E_NOTICE error because your
> > >   error level is turned down (by default).  Put this on top
> > >   of your script to see them all:
> > >
> > >     error_reporting(E_ALL);
> > >
> > >   Regards,
> > >   Philip
> > >
> > >
> > > > same thing with fetch_object()...and i have 1 row in the members
> > table..im
> > > > sort of confused now that it doesnt work for a wierd reason
> > > >
> > > > any better ideas on how to get the stuff out of the table and into
vars?
> > > > maybe im doing it wrong
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Saturday, February 01, 2003 5:33 PM
> > > > Subject: Re: [PHP] using <input> tags with php
> > > >
> > > >
> > > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
> > > > > [EMAIL PROTECTED] writes:
> > > > >
> > > > > >i tried getting the values into vars using
fetch_array/fetch_object
> > and
> > > > > >fetch_row and tried to put them in variables but for some odd
reason
> > it
> > > > > >really doesnt work because when i try to use the vars in the
value
> > > > section
> > > > > >instead of printing in the edit box the content of the variable i
> > usually
> > > > > >end up with "?>", ">", "<?php", or "}?>" instead... any reason
this
> > shows
> > > > > >up? and when i do:
> > > > > >echo "<input type=text name=$name value='$new_var'>";
> > > > > >then on the web page i end up with some thing like this instead
of
> > the
> > > > edit
> > > > > >box:
> > > > > >">";;">
> > > > > >}?>
> > > > > >any reason for that?
> > > > >
> > > > > It sounds like $name and/or $new_var may be empty. Did you echo
the
> > > > variables
> > > > > before using them in your form to check whether the values from
the
> > > > database
> > > > > are actually in the variables?
> > > > >
> > > > > Janet
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > > >
> > > > ---
> > > > Outgoing mail is certified Virus Free.
> > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

--- End Message ---
--- Begin Message ---
 > i want to set up a form that will load values from a table
 > and make them the
 > "value" of the edit box... then when people press an update
 > button then all
 > of the stuff that changes from the record already in the table gets
 > changed... anybody know how to make it where you can get the
 > values out of a
 > table and make them the default value of a input field...?

What is it that you're having trouble with?  The logic to do what you
want?  The actual code to load values from a table (a database table I
presume)?  The correct HTML that you need to have values in a form
field?  The code to update your database with information from the form?

Perhaps if you got started with working out what you want to do and then
ask questions.

Failing that, I'd be happy to write it for you.  Of course, I'll charge
my normal hourly rate to do so...

CYA, Dave




--- End Message ---
--- Begin Message ---
 > i am having a problem using <input> tags by using current
 > values kept in a mysql table. how do you get the values out of the
table and
 > into a form so they show as the value= part of the tag?

Start by making a basic test:

 <?PHP
 $some_string = "some string";
 echo "<input type=\"text\" name=\"some_string\" value=\"$some_string\"
size=20>";
 ?>

or you could try this:

 <?PHP
 $some_string = "some string";
 ?>
 <input type="text" name="some_string" value="<?=$some_string?>"
size=20>

Either should work.

Rinse and repeat as necessary.

CYA, Dave




--- End Message ---
--- Begin Message --- Are you absolutely sure that the query gives result? Try and add "or die (mysql_error())" behind mysql_connect, mysql_select_db and mysql_query. For the rest, it looks pretty good to me....


Sunfire wrote:
ok let me try this question thing again...

i am having a problem using <input> tags by using current values kept in a
mysql table. how do you get the values out of the table and into a form so
they show as the value= part of the tag?
i tried just aabout everything and it doesnt work even htmlspecialchars()
doesnt work.. all i get for output on the page is the rest of the script
printed on the screen after the value= part of the tag..is there any way to
fix it?


----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Sunfire" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 8:01 PM
Subject: Re: [PHP] using <input> tags with php



On Sat, 1 Feb 2003, Sunfire wrote:


hi.. i took your idea...
i put the error reporting code at the top of the script and ran it as

the

problem was still there to see what would happen.. instead i get 0

messages

from the reporting system and all i get is the last 7 chars of the print
line and the }?> at the end of the script... so for instance if i do:
print("<input type=\"text\" name=\"company\" value=$new['company']\n");
or any variance of that statement changing around the \" and apostrophes
around to try different things all i get is the rest of the script

starting

from the \n all the way to the rest of the script where it says }?> at

the

end dont know if this is a bug or not but its getting hard to figure out
what the problem with my echo or print statements are...
here is the whole script:
its supposed to get all fields and then display in input text boxes the
current values in that certain record  i know i missed some stuff in it

with

the query but at this point was supposed to be a test to see if i could

even

put it in the box in the first place... but here is the code:
Please step back, slow down, and write your question
in a short concise format.  I have no clue what the
above means.


<html>
<head>
<title>edit member</title>

</head>

<form action=edit1.php method=post>
pick some of these:<br>
<?php
error_reporting(E_ALL);
mysql_connect("192.4.5.6", "root", "");
mysql_select_db("wata");
$result=mysql_query("select * from members where company like 'test'");
while($row=mysql_fetch_array($result)){
print("<input type=text name=company value=\"$row[company\"]>\n\n");
// Try this instead, see also: htmlspecialchars()*
print "<input type='text' name='company' value='{$row['company']}'>";

Regards,
Philip

* http://www.php.net/manual/en/faq.html.php#faq.html.encoding



}
?>
<input type="submit" value="send">
</form>
</html>

/*end*/
any changes to make it work would be appreciated...tnx


----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Sunfire" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 6:48 PM
Subject: Re: [PHP] using <input> tags with php (IMPORTANT READ)



On Sat, 1 Feb 2003, Sunfire wrote:


if i do this:
/*all the mysql login stuff here*/

$query=mysql_query("select * from members");
while($new=mysql_fetch_array($query)){
echo "$new['company']";
/*so on through the field list*/
}
on output all i get is the title with a submit button..
otherwise blank..
 There is a bug in PHP 4.3.0 regarding the use of arrays
 in strings.  The following gave a parse error before
 PHP 4.3.0:

   print "Do not do this: $arr['key']";

 Now it gives an E_NOTICE error due to changes to the string
 scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
 and instead it will work (no parse error either).  Surrounding
 the array with {braces} in the string works regardless, so:

   print "You can do this: {$arr['key']}";

 Regarding this question, don't write it like that but instead
 do the following (no quotes needed):

   echo $new['company'];

 For those wondering about this bug, see:

   http://bugs.php.net/bug.php?id=21820

 The string documentation has been updated to demonstrate
 the array in string phenomena (except the bug hasn't been
 mentioned as I'm waiting for it to be committed first).

   http://www.php.net/types.string

 Sunfire, you aren't seeing this E_NOTICE error because your
 error level is turned down (by default).  Put this on top
 of your script to see them all:

   error_reporting(E_ALL);

 Regards,
 Philip



same thing with fetch_object()...and i have 1 row in the members

table..im

sort of confused now that it doesnt work for a wierd reason

any better ideas on how to get the stuff out of the table and into

vars?

maybe im doing it wrong


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 5:33 PM
Subject: Re: [PHP] using <input> tags with php



In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
[EMAIL PROTECTED] writes:


i tried getting the values into vars using

fetch_array/fetch_object

and

fetch_row and tried to put them in variables but for some odd

reason

it

really doesnt work because when i try to use the vars in the

value

section

instead of printing in the edit box the content of the variable i

usually

end up with "?>", ">", "<?php", or "}?>" instead... any reason

this

shows

up? and when i do:
echo "<input type=text name=$name value='$new_var'>";
then on the web page i end up with some thing like this instead

of

the

edit

box:
">";;">
}?>
any reason for that?
It sounds like $name and/or $new_var may be empty. Did you echo

the

variables

before using them in your form to check whether the values from

the

database

are actually in the variables?

Janet

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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


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



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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


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


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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


--- End Message ---
--- Begin Message ---
> On Sat, 2003-02-01 at 17:25, John W. Holmes wrote:
> > > I'm loading a .csv file into MySQL, done it a million times but
for
> > some
> > > reason it is scrambling the row order. All the fields are making
it in
> > > correctly but the order of the rows seems to end up totally
random.
> > I've
> > > done this a million times and never saw this..
> >
> > So?
> >
> > Why does it matter to you what order the rows are in the database,
as
> > long as the right data is there? The order is irrelevant.
> >
> 
> Because in this instance I need it to come out in the order it is
> actually in.

Then use an ORDER BY in your query. If you're relying on the database to
spit out rows in the order they went in, then you're wrong.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


--- End Message ---
--- Begin Message ---
You could create a integer column with an autoincrement flag, then order
the rows by this column, that should give you the data in the order it
was inserted into the db.  Depending on your database there are other
ways to do it.

Jason
On Sat, 2003-02-01 at 18:07, John W. Holmes wrote:
> > On Sat, 2003-02-01 at 17:25, John W. Holmes wrote:
> > > > I'm loading a .csv file into MySQL, done it a million times but
> for
> > > some
> > > > reason it is scrambling the row order. All the fields are making
> it in
> > > > correctly but the order of the rows seems to end up totally
> random.
> > > I've
> > > > done this a million times and never saw this..
> > >
> > > So?
> > >
> > > Why does it matter to you what order the rows are in the database,
> as
> > > long as the right data is there? The order is irrelevant.
> > >
> > 
> > Because in this instance I need it to come out in the order it is
> > actually in.
> 
> Then use an ORDER BY in your query. If you're relying on the database to
> spit out rows in the order they went in, then you're wrong.
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Or add a "insert_date" column of type "timestamp" to the database. This will automatically store the time of insertion. Then use ORDER BY insert_date.


Edwin

Jason Sheets wrote:
You could create a integer column with an autoincrement flag, then order
the rows by this column, that should give you the data in the order it
was inserted into the db.  Depending on your database there are other
ways to do it.

Jason
On Sat, 2003-02-01 at 18:07, John W. Holmes wrote:

On Sat, 2003-02-01 at 17:25, John W. Holmes wrote:

I'm loading a .csv file into MySQL, done it a million times but

for

some

reason it is scrambling the row order. All the fields are making

it in

correctly but the order of the rows seems to end up totally

random.

I've

done this a million times and never saw this..
So?

Why does it matter to you what order the rows are in the database,

as

long as the right data is there? The order is irrelevant.

Because in this instance I need it to come out in the order it is
actually in.
Then use an ORDER BY in your query. If you're relying on the database to
spit out rows in the order they went in, then you're wrong.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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


--- End Message ---
--- Begin Message ---
hi sorry to ask so many questions but i have now realised that php3 doesnt
handle the callback error handling so i can return the line and file of the
error into a function is there a way to emulate this in php3 ?


--- End Message ---
--- Begin Message ---
to be a bit less vague , i have a db query wrapper function, and checks for
mysql errors if there is one it needs to catch it to a callback function
although php3 doesnt handle callback functions so you have to give it the
line and file, is there anyway i can try and get away from putting the line
and file in the function like this ?

$query = $db->query("select * from artists where
artistI=1",__LINE__,__FILE__);

"Electroteque" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi sorry to ask so many questions but i have now realised that php3 doesnt
> handle the callback error handling so i can return the line and file of
the
> error into a function is there a way to emulate this in php3 ?
>
>


--- End Message ---
--- Begin Message ---
I've read that an include file in each of your pages with the lines below
should do the trick for you with register_globals OFF..

Not sure if this is a valid way to go though...

<?php
     extract($_SERVER);
     extract($_ENV);
     extract($_GET);
     extract($_POST);
     extract($_REQUEST);
?>

Regards, Pat



"Davy Obdam" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello people,
>
> On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55)
> i have several websites that i made some time ago that require register
> globals to be On in the php.ini. Ofcourse i know thats not a good idea
> at all for security, but rewriting all this code is not an option.
> However in my php.ini i have set register globals to Off because that
> better. Is it possible to configure my webserver/php so that only those
> sites that require register globals to be On have that setting, for
> instance in a .htacces file?? Any help is appreciated:-)
>
> Best regards,
>
> Davy Obdam
> mailto:[EMAIL PROTECTED]
>
>


--- End Message ---
--- Begin Message ---
On Sun, 2 Feb 2003, Pat Johnston wrote:

> I've read that an include file in each of your pages with the lines below
> should do the trick for you with register_globals OFF..
> 
> Not sure if this is a valid way to go though...
> 
> <?php
>      extract($_SERVER);
>      extract($_ENV);
>      extract($_GET);
>      extract($_POST);
>      extract($_REQUEST);
> ?>

Whoever told you this should be shot as this is an enormous
security hole!  The above is a security hole much larger 
than register_globals could ever hope to be.  That and it's 
silly to attempt to mimic register_globals at runtime.

The above is insecure in that it will overwrite web server 
variables ($_SERVER) with request variables such as those 
from $_GET.  This is TERRIBLE!!!  Just imagine this as
just an example:

  http://www.example.com/a.php?PHP_SELF=http://www.foo.com

In the above scenerio, this would create $PHP_SELF
first from $_SERVER then it'd be overwritten by the
$_GET and than by the $_REQUEST that had the GET in
it.  So this makes it inefficient and insecure :) A
better example exists but anyway this should show a
nice point (like maybe PHP_AUTH_PW or REMOTE_USER).

Anyway, sorry for the rant but it's just that whoever
told you that should not tell anyone anything related
to this topic.

The best options are:
  a) rewrite the code or
  b) set register_globals with .htaccess or php.ini
     or in virtualhost in httpd.conf

  http://www.php.net/manual/en/configuration.changes.php

Now if you must set it at runtime (please do not do this)
then you could try this:

 // THIS IS NOT RECOMMENDED
 if (!ini_get('register_globals')) { 
   $types_to_register = array('GET','POST','COOKIE',
                              'SESSION','SERVER'); 
   foreach ($types_to_register as $type) { 
     if (@count(${'HTTP_' . $type . '_VARS'}) > 0) { 
       extract(${'HTTP_' . $type . '_VARS'}, EXTR_OVERWRITE); 
     } 
   } 
 }
 // THIS IS NOT RECOMMENDED

Although it doesn't depend on the variables_order directive
like register_globals does, it is flexible.  Keep in mind
that variables are written from first to last so you
certainly don't want GET coming after SERVER.

Regards,
Philip



> "Davy Obdam" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello people,
> >
> > On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55)
> > i have several websites that i made some time ago that require register
> > globals to be On in the php.ini. Ofcourse i know thats not a good idea
> > at all for security, but rewriting all this code is not an option.
> > However in my php.ini i have set register globals to Off because that
> > better. Is it possible to configure my webserver/php so that only those
> > sites that require register globals to be On have that setting, for
> > instance in a .htacces file?? Any help is appreciated:-)
> >
> > Best regards,
> >
> > Davy Obdam
> > mailto:[EMAIL PROTECTED]
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Perfect. Thanks.

----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 2:22 PM
Subject: Re: [PHP] Passing Variables


> On Sat, 1 Feb 2003, Beauford.2002 wrote:
>
> > Hi,
> >
> > Is there a way to pass a variable to a PHP script without using a form?
I
> > want to put several links on my main page that when clicked on goes to a
PHP
> > script - depending on what link was selected, will determine what part
of
> > the PHP script gets executed.
>
> Yes, use GET:
>
>   <a href="foo.php?fruit=apple">eat an apple</a>
>
> See also if() and switch()
>
>   http://www.php.net/else
>   http://www.php.net/switch
>   http://www.php.net/variables.external
>
>   print $_GET['fruit'];
>
> Regards,
> Philip
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Nicole <[EMAIL PROTECTED]> wrote:
> I am having trouble doing things with PHP such as use the exec, system,
> etc. functions. I can't seem to find the correct php.ini to turn safe_mode
> off. The one file I did find has safe_mode turned off. When I view phpinfo()
> it shows the global column with safe_mode off, but for the local column, it
> is on. Is there a local php.ini file for each site?

No. But the values found in the global php.ini can be changed in
Apache's httpd.conf and in .htaccess files. See
<http://www.php.net/manual/en/configuration.changes.php>. 

You can have a .htaccess file in every directory to pass additional
options to Apache (and mod_php). A .htaccess is used for the directory
where it resides and for all subdirectories.

Try "locate .htaccess" or "find / -name .htaccess".

> I need to call a script to run in the background and I want to be able to
> use exec() to call it. Is there an alternative way to do this without
> bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at
> the same rate, I am the only one with access to the server as it is my
> dedicated server.

If you're the only person on that machine, there's no point in using
safe mode.

> I am not familiar enough with Linux just yet to know how to give permissions
> to my sites to use things such as cron which I desperately need to figure
> out. I know how to add a crontab for a user, etc.  But when the cron file
> runs, I just get a permission denied. I have tried it for both root and the
> site user. The only thing that does work is me getting an email stating
> permission denied. So I know my crontab file is correct. As far as
> permissions, I'm in a cloud. I have no idea what to do to make it work and
> maintain a secure system.

Perhaps you just forgot to make your program/script executable ("chmod
+x your_script").
 
> Anyone know where some great (free) docs that will show me how to fish
> around in Linux? I don't need to be hand fed. Just some direction. Thanks!

Almost all programs have man pages, so you can use "man chmod" to find
out about "chmod". And then there's the Linux Documentation Project
<http://www.tldp.org/>, which has lots of howtos.

Regards...
                Michael
--- End Message ---
--- Begin Message ---
Thank you. Yes, I did chmod my scripts. chmod 754 and tried 755 too. Don't
see why it should be x on the world, though. I would think if the script is
being called by its owner, then x on the owner and group should be enough,
no?

I'm even using !#/usr/bin/php ... but then it doesn't even seem to be using
it.

I'll go through the man pages again, too.

The "find" and "locate" commands will be useful. I will try those. Thanks!
Although since you mentioned the local configuration via apache's .htaccess,
maybe that is what I need. I still can't figure out how to turn safe mode
off for the local column.

Thanks,

Nicole

--

"Michael Mauch" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Nicole <[EMAIL PROTECTED]> wrote:
> > I am having trouble doing things with PHP such as use the exec, system,
> > etc. functions. I can't seem to find the correct php.ini to turn
safe_mode
> > off. The one file I did find has safe_mode turned off. When I view
phpinfo()
> > it shows the global column with safe_mode off, but for the local column,
it
> > is on. Is there a local php.ini file for each site?
>
> No. But the values found in the global php.ini can be changed in
> Apache's httpd.conf and in .htaccess files. See
> <http://www.php.net/manual/en/configuration.changes.php>.
>
> You can have a .htaccess file in every directory to pass additional
> options to Apache (and mod_php). A .htaccess is used for the directory
> where it resides and for all subdirectories.
>
> Try "locate .htaccess" or "find / -name .htaccess".
>
> > I need to call a script to run in the background and I want to be able
to
> > use exec() to call it. Is there an alternative way to do this without
> > bothering with the safe_mode value? i'd prefer to leave safe_mode on;
but at
> > the same rate, I am the only one with access to the server as it is my
> > dedicated server.
>
> If you're the only person on that machine, there's no point in using
> safe mode.
>
> > I am not familiar enough with Linux just yet to know how to give
permissions
> > to my sites to use things such as cron which I desperately need to
figure
> > out. I know how to add a crontab for a user, etc.  But when the cron
file
> > runs, I just get a permission denied. I have tried it for both root and
the
> > site user. The only thing that does work is me getting an email stating
> > permission denied. So I know my crontab file is correct. As far as
> > permissions, I'm in a cloud. I have no idea what to do to make it work
and
> > maintain a secure system.
>
> Perhaps you just forgot to make your program/script executable ("chmod
> +x your_script").
>
> > Anyone know where some great (free) docs that will show me how to fish
> > around in Linux? I don't need to be hand fed. Just some direction.
Thanks!
>
> Almost all programs have man pages, so you can use "man chmod" to find
> out about "chmod". And then there's the Linux Documentation Project
> <http://www.tldp.org/>, which has lots of howtos.
>
> Regards...
> Michael


--- End Message ---
--- Begin Message ---
correction:

#!/usr/bin/php

--
Nicole
URLTrak.com
ElixirSafelist.com
aeontrek.com
"Nicole" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thank you. Yes, I did chmod my scripts. chmod 754 and tried 755 too. Don't
> see why it should be x on the world, though. I would think if the script
is
> being called by its owner, then x on the owner and group should be enough,
> no?
>
> I'm even using !#/usr/bin/php ... but then it doesn't even seem to be
using
> it.
>
> I'll go through the man pages again, too.
>
> The "find" and "locate" commands will be useful. I will try those. Thanks!
> Although since you mentioned the local configuration via apache's
.htaccess,
> maybe that is what I need. I still can't figure out how to turn safe mode
> off for the local column.
>
> Thanks,
>
> Nicole
>
> --
>
> "Michael Mauch" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Nicole <[EMAIL PROTECTED]> wrote:
> > > I am having trouble doing things with PHP such as use the exec,
system,
> > > etc. functions. I can't seem to find the correct php.ini to turn
> safe_mode
> > > off. The one file I did find has safe_mode turned off. When I view
> phpinfo()
> > > it shows the global column with safe_mode off, but for the local
column,
> it
> > > is on. Is there a local php.ini file for each site?
> >
> > No. But the values found in the global php.ini can be changed in
> > Apache's httpd.conf and in .htaccess files. See
> > <http://www.php.net/manual/en/configuration.changes.php>.
> >
> > You can have a .htaccess file in every directory to pass additional
> > options to Apache (and mod_php). A .htaccess is used for the directory
> > where it resides and for all subdirectories.
> >
> > Try "locate .htaccess" or "find / -name .htaccess".
> >
> > > I need to call a script to run in the background and I want to be able
> to
> > > use exec() to call it. Is there an alternative way to do this without
> > > bothering with the safe_mode value? i'd prefer to leave safe_mode on;
> but at
> > > the same rate, I am the only one with access to the server as it is my
> > > dedicated server.
> >
> > If you're the only person on that machine, there's no point in using
> > safe mode.
> >
> > > I am not familiar enough with Linux just yet to know how to give
> permissions
> > > to my sites to use things such as cron which I desperately need to
> figure
> > > out. I know how to add a crontab for a user, etc.  But when the cron
> file
> > > runs, I just get a permission denied. I have tried it for both root
and
> the
> > > site user. The only thing that does work is me getting an email
stating
> > > permission denied. So I know my crontab file is correct. As far as
> > > permissions, I'm in a cloud. I have no idea what to do to make it work
> and
> > > maintain a secure system.
> >
> > Perhaps you just forgot to make your program/script executable ("chmod
> > +x your_script").
> >
> > > Anyone know where some great (free) docs that will show me how to fish
> > > around in Linux? I don't need to be hand fed. Just some direction.
> Thanks!
> >
> > Almost all programs have man pages, so you can use "man chmod" to find
> > out about "chmod". And then there's the Linux Documentation Project
> > <http://www.tldp.org/>, which has lots of howtos.
> >
> > Regards...
> > Michael
>
>


--- End Message ---
--- Begin Message ---
Weston Houghton wrote:

> 
> All,
> 
> I seem to be getting a silly error on Solaris when trying to do a PHP
> 4.3 make. I get an error that looks to me like the liner arguments are
> just too long. to be honest, I'm a bit stupified as to why this is
> happening or how to fix it. FWIW, I have compiled 4.23 just fine on
> that box.
> 
> Thanks,
> Wes
> 
> 
> p.s. here's the last bit of the error:
> 
> /bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2
> -avoid-version -module -L/usr/ucblib
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1
> -L/export/home/oracle/OraHome/lib  -R /usr/ucblib -R
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -R
> /export/home/oracle/OraHome/lib ext/ctype/ctype.lo ext/ftp/php_ftp.lo
> ext/ftp/ftp.lo ext/mysql/php_mysql.lo ext/mysql/libmysql/libmysql.lo

<snip>

Install GNU sed. The standard Solaris sed can't handle input that long. (I
believe it has a character limit of 4096 characters or something to that
effect.) GNU's sed doesn't have that limit.

Installing the package from www.sunfreeware.com will put GNU sed in
/usr/local. Make sure that make can find the GNU sed before it finds Sun's
sed by putting /usr/local/bin before /usr/bin in your $PATH.

J
--- End Message ---
--- Begin Message ---
On Friday, January 31, 2003, at 08:13  PM, Weston Houghton wrote:

I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box.
I built 4.3.0 on Solaris 2.6 and Solaris 8 without trouble. But as another poster suggested, I am using GNU utils (sed, make, etc).

--- End Message ---
--- Begin Message ---
I have a PHP script that works on older versions of PHP but on 4.3, it
outputs nothing. Here's my code:

<?php
echo '<SCRIPT language="JavaScript" type="text/javascript">'."\n"
    ."\n".'if (document.location == top.location)'."\n"
    .'  top.location="home.php?goto='
       .base64_encode($_SERVER["REQUEST_URI"]).'";'."\n"
    .'</SCRIPT>';
?>

The problem is, when it redirects, the URL variable goto is empty. I'm
assuming this has something to do with base64_encode. Since this code snipet
is on every page of my site, it'd be a hard hassle to change it so is there
a setting in PHP I need to tweak or should I set aside a few hours to edit
this code? If the latter, what should I change it to?

Thanks,
Stephen Craton
http://www.melchior.us

"What's the point in appearance if your true love, doesn't care about
it?" -- http://www.melchior.us
--- End Message ---
--- Begin Message ---
What about $_GET['goto']??? Sounds like another register_globals issue. Also, 
instead of base64 encoding, you may want to use the rawurlencode and 
rawurldecode functions.



On Saturday 01 February 2003 07:02 pm, Stephen wrote:
> I have a PHP script that works on older versions of PHP but on 4.3, it
> outputs nothing. Here's my code:
>
> <?php
> echo '<SCRIPT language="JavaScript" type="text/javascript">'."\n"
>     ."\n".'if (document.location == top.location)'."\n"
>     .'  top.location="home.php?goto='
>        .base64_encode($_SERVER["REQUEST_URI"]).'";'."\n"
>     .'</SCRIPT>';
> ?>
>
> The problem is, when it redirects, the URL variable goto is empty. I'm
> assuming this has something to do with base64_encode. Since this code
> snipet is on every page of my site, it'd be a hard hassle to change it so
> is there a setting in PHP I need to tweak or should I set aside a few hours
> to edit this code? If the latter, what should I change it to?
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
> "What's the point in appearance if your true love, doesn't care about
> it?" -- http://www.melchior.us

-- 
If anyone can show me, and prove to me, that I am wrong in thought or deed, I 
will gladly change. I seek the truth, hich never yet hurt anybody. It is only 
persistence in elf-delusion and ignorance which does harm.

-Marcus Aurelius

--- End Message ---
--- Begin Message ---
I am displaying a form using values obtained from a database query.
One of the elements contains about 20 different values. I want the
use to be able to select multiple values before pressing submit.

This seems to work, but when my php script is called, all I see is
the last data value assigned to the variable. I could use a pointer.

Here is a code snippet:

      echo "<TR>\n";
      echo "  <TD>Task Description</TD>\n";
      echo "  <TD><SELECT NAME='in_task_descr' MULTIPLE SIZE=4>\n";
      for ($j = 0; $j < $tskcount; $j++) {
        echo "<OPTION VALUE=\"$taskdescr[$j]\">$taskdescr[$j]</OPTION>\n";
      }
      echo "  </SELECT>\n";
      echo "  </TD>\n";
      echo "</TR>\n\n";

The above code adds a list to the form and the user can highlight more than one
entry.

How do I access the data after the user presses submit?

-- 
Jim Kaufman             mailto:[EMAIL PROTECTED]
Linux Evangelist        cell: 612-481-9778              
public key 0x6D802619   fax:  952-937-9832
http://www.linuxforbusiness.net
--- End Message ---
--- Begin Message --- Put empty square brackets (NAME='in_task_descr[]') after the name of your select element. Then all the slections will be in an array called...

$_POST['in_task_descr'] or
$_GET['in_task_descr']

Depending on your form method.

James Kaufman wrote:
I am displaying a form using values obtained from a database query.
One of the elements contains about 20 different values. I want the
use to be able to select multiple values before pressing submit.

This seems to work, but when my php script is called, all I see is
the last data value assigned to the variable. I could use a pointer.

Here is a code snippet:

      echo "<TR>\n";
      echo "  <TD>Task Description</TD>\n";
      echo "  <TD><SELECT NAME='in_task_descr' MULTIPLE SIZE=4>\n";
      for ($j = 0; $j < $tskcount; $j++) {
        echo "<OPTION VALUE=\"$taskdescr[$j]\">$taskdescr[$j]</OPTION>\n";
      }
      echo "  </SELECT>\n";
      echo "  </TD>\n";
      echo "</TR>\n\n";

The above code adds a list to the form and the user can highlight more than one
entry.

How do I access the data after the user presses submit?


--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

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

Sunday, February 2, 2003, 1:29:30 PM, you wrote:
JK> I am displaying a form using values obtained from a database query.
JK> One of the elements contains about 20 different values. I want the
JK> use to be able to select multiple values before pressing submit.

JK> This seems to work, but when my php script is called, all I see is
JK> the last data value assigned to the variable. I could use a pointer.

JK> Here is a code snippet:

JK>       echo "<TR>\n";
JK>       echo "  <TD>Task Description</TD>\n";
JK>       echo "  <TD><SELECT NAME='in_task_descr' MULTIPLE SIZE=4>\n";
JK>       for ($j = 0; $j < $tskcount; $j++) {
JK>         echo "<OPTION VALUE=\"$taskdescr[$j]\">$taskdescr[$j]</OPTION>\n";
JK>       }
JK>       echo "  </SELECT>\n";
JK>       echo "  </TD>\n";
JK>       echo "</TR>\n\n";

JK> The above code adds a list to the form and the user can highlight more than one
JK> entry.

JK> How do I access the data after the user presses submit?

JK> -- 
JK> Jim Kaufman             mailto:[EMAIL PROTECTED]
JK> Linux Evangelist        cell: 612-481-9778              
JK> public key 0x6D802619   fax:  952-937-9832
JK> http://www.linuxforbusiness.net


This popped up using google
http://www.onlinetools.org/tricks/using_multiple_select.php

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
PHP keeps track of what line# is being executed, so that when there's an 
error (say in pg_exec() ) it reports what line the error occured on. 

This appears to happen even during runtime (not just during compilation). 

For example: 
-------------------------
<?
$dbname="mydb"; 
$dbuser="myuser"; 
$dbpass="mypw"; 

$conn=pg_connect("dbname=$dbname, user=$dbuser, password=$dbpass"); 
$cmd="go and ask the mice"; 
$result=pg_exec($conn, $cmd); 
?>
--------------------------

This would result in a pg_exec error ~ line 7. PHP tracks this, even though 
the error is during runtime, not during the precompile. 

Is there a function where I can access this information? Something like 
"get_line();" or something? 

This would be REALLY HANDY for debugging large projects... 

-Ben 
--- End Message ---
--- Begin Message ---
I think what you are looking for is: 
__LINE__

See: http://www.php.net/manual/en/language.constants.predefined.php

Cheers,
Steven Balthazor

-----Original Message-----
From: Benjamin Smith [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, February 01, 2003 8:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Line Number function?


PHP keeps track of what line# is being executed, so that when there's an 
error (say in pg_exec() ) it reports what line the error occured on. 

This appears to happen even during runtime (not just during compilation). 

For example: 
-------------------------
<?
$dbname="mydb"; 
$dbuser="myuser"; 
$dbpass="mypw"; 

$conn=pg_connect("dbname=$dbname, user=$dbuser, password=$dbpass"); 
$cmd="go and ask the mice"; 
$result=pg_exec($conn, $cmd); 
?>
--------------------------

This would result in a pg_exec error ~ line 7. PHP tracks this, even though 
the error is during runtime, not during the precompile. 

Is there a function where I can access this information? Something like 
"get_line();" or something? 

This would be REALLY HANDY for debugging large projects... 

-Ben 

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

--- End Message ---
--- Begin Message ---
On Sat, 1 Feb 2003 19:59:00 -0800, you wrote:

>PHP keeps track of what line# is being executed, so that when there's an 
>error (say in pg_exec() ) it reports what line the error occured on. 
[...]
>Is there a function where I can access this information? Something like 
>"get_line();" or something? 

Do you mean like the predefined "constant" __LINE__?

http://www.php.net/manual/en/language.constants.predefined.php

Sorry if I'm misunderstanding the question...
--- End Message ---
--- Begin Message ---
On Sun, 2 Feb 2003, Michael Sims wrote:

> On Sat, 1 Feb 2003 19:59:00 -0800, you wrote:
> 
> >PHP keeps track of what line# is being executed, so that when there's an 
> >error (say in pg_exec() ) it reports what line the error occured on. 
> [...]
> >Is there a function where I can access this information? Something like 
> >"get_line();" or something? 
> 
> Do you mean like the predefined "constant" __LINE__?
> 
> http://www.php.net/manual/en/language.constants.predefined.php

Yep, that will do it and has been available in PHP for a
very long time (along with __FILE__).  PHP 4.3.0 introduces
the following:

  __FUNCTION__       Function name
  __CLASS__          Class name
  debug_backtrace()  Debugging information including the
                     line number

See: http://www.php.net/debug_backtrace

Regards,
Philip

--- End Message ---
--- Begin Message ---
Is it possible (using an apache directive, perhaps?) to turn off php parsing 
for certain directories within a site? (but not others?) 

I picture something like (in httpd.conf) 

<directory /home/www/somesite.com/codearchive>
 AllowOverride All
 Options FollowSymLinks
 NoParsePHP
</directory>

Can this be done? How? Perhaps as a php_value entry in the <VirtualHost> 
directive? 

Thanks,

-Ben 
--- End Message ---
--- Begin Message ---
If you don't use <?php tags in the file it won't make a huge different
if it is on or
off... but if you don't want any parsing see below.

In your .htaccess file do the following for the file types to be turned
off
and remember that this will be from here out in the doc tree:

AddType text/html .html .php



Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: [EMAIL PROTECTED]

> -----Original Message-----
> From: Benjamin Smith [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, 2 February 2003 3:32 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Turn off PHP for certain directories?
>
>
> Is it possible (using an apache directive, perhaps?) to turn
> off php parsing
> for certain directories within a site? (but not others?)
>
> I picture something like (in httpd.conf)
>
> <directory /home/www/somesite.com/codearchive>
>  AllowOverride All
>  Options FollowSymLinks
>  NoParsePHP
> </directory>
>
> Can this be done? How? Perhaps as a php_value entry in the
> <VirtualHost>
> directive?
>
> Thanks,
>
> -Ben
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Sunday, February 2, 2003, 3:32:28 PM, you wrote:
BS> Is it possible (using an apache directive, perhaps?) to turn off php parsing 
BS> for certain directories within a site? (but not others?) 

BS> I picture something like (in httpd.conf) 

BS> <directory /home/www/somesite.com/codearchive>
BS>  AllowOverride All
BS>  Options FollowSymLinks
BS>  NoParsePHP
BS> </directory>

BS> Can this be done? How? Perhaps as a php_value entry in the <VirtualHost> 
BS> directive? 

BS> Thanks,

BS> -Ben 


you could try

php_flag engine = Off

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
At 12:25 02.02.2003, Tom Rogers said:
--------------------[snip]--------------------
>you could try
>
>php_flag engine = Off
--------------------[snip]-------------------- 

I've tried (this works):
In the configuration for the virtual host:
    AllowOverride All

In .htaccess:
    AddType text/plain .php

engine=off returns an apache config error.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Howdy ...

I've just installed php, zend developer, mysqladmin, and apache on my pc
laptop.

Are there any available for mac 8.6 ?

cheers,

bobbi-lea


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CyberFaerie
media :: entertainment

m::  0411 543 554
e::   [EMAIL PROTECTED]
a::   32 acland dr, strathpine, qld 4500
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to which they
are addressed. If you have received this e-mail in error you are
prohibited from disclosing, copying or using the information contained
in it. If you have received this email in error, please inform us by
email reply and delete the message and attached documents. This footnote
also confirms that this email message has been swept for the presence of
computer viruses. 

--- End Message ---
--- Begin Message ---
If you are referring to php etc NO and for Zend NO.


Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: [EMAIL PROTECTED]

> -----Original Message-----
> From: Bobbi-Lea [mailto:[EMAIL PROTECTED]] 
> Sent: Sunday, 2 February 2003 2:30 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] php and Mac running 8.6
> 
> 
> Howdy ...
> 
> I've just installed php, zend developer, mysqladmin, and 
> apache on my pc laptop.
> 
> Are there any available for mac 8.6 ?
> 
> cheers,
> 
> bobbi-lea
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> CyberFaerie
> media :: entertainment
> 
> m::  0411 543 554
> e::   [EMAIL PROTECTED]
> a::   32 acland dr, strathpine, qld 4500
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This email and any files transmitted with it are confidential 
> and intended solely for the use of the individual or entity 
> to which they are addressed. If you have received this e-mail 
> in error you are prohibited from disclosing, copying or using 
> the information contained in it. If you have received this 
> email in error, please inform us by email reply and delete 
> the message and attached documents. This footnote also 
> confirms that this email message has been swept for the 
> presence of computer viruses. 
> 
> 

--- End Message ---
--- Begin Message ---
on 02/02/03 3:30 PM, Bobbi-Lea ([EMAIL PROTECTED]) wrote:

> I've just installed php, zend developer, mysqladmin, and apache on my pc
> laptop.
> 
> Are there any available for mac 8.6 ?

Not to the best of my knowledge... mac OSX has though :)

Justin

--- End Message ---
--- Begin Message ---
Hello guys and gals!!!

can you tell me why i can't get this script to print my 
table....

thanks Karl 

please check out the code below
obviously i left my username and passwords blank :-)

 
-----------------------------------------------------------------------------
--------------------------------------------------------
<?
$sqlhost = "localhost";
$sqllogin = "login";
$sqlpw = "password"; 
$sqldb = "database table name";
(@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) {
die(mysql_error()); }
(@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); }
$result = mysql_query("SELECT * FROM `assignment_one`");
while($array = mysql_fetch_array($result)) {
echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
$array[password], $array[status], $array[notes]);
}
?>
-------------------------------------------------------------------------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
$array[password], $array[status], $array[notes]);

try
echo "| %s | %s | %s | %s | %s |<br />".$array[id]." ".$array[username]."
".$array[password]." ".$array[status]." ".$array[notes];

dots not comas between variables.
Hope this helps.
Hugh
----- Original Message -----
From: "Karl James" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Friday, January 31, 2003 10:37 PM
Subject: [PHP] help with script!!!


Hello guys and gals!!!

can you tell me why i can't get this script to print my
table....

thanks Karl

please check out the code below
obviously i left my username and passwords blank :-)


----------------------------------------------------------------------------
-
--------------------------------------------------------
<?
$sqlhost = "localhost";
$sqllogin = "login";
$sqlpw = "password";
$sqldb = "database table name";
(@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) {
die(mysql_error()); }
(@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); }
$result = mysql_query("SELECT * FROM `assignment_one`");
while($array = mysql_fetch_array($result)) {
echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
$array[password], $array[status], $array[notes]);
}
?>
----------------------------------------------------------------------------
---------------------------------------------------------

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


--- End Message ---
--- Begin Message ---
On Sat, 1 Feb 2003, Karl James wrote:

> Hello guys and gals!!!
> 
> can you tell me why i can't get this script to print my 
> table....
> 
> thanks Karl 
> 
> please check out the code below
> obviously i left my username and passwords blank :-)
> 
>  
> -----------------------------------------------------------------------------
> --------------------------------------------------------
> <?
> $sqlhost = "localhost";
> $sqllogin = "login";
> $sqlpw = "password"; 
> $sqldb = "database table name";
> (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) {
> die(mysql_error()); }
> (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); }
> $result = mysql_query("SELECT * FROM `assignment_one`");
> while($array = mysql_fetch_array($result)) {
> echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
> $array[password], $array[status], $array[notes]);
> }
> ?>


Maybe this will help:

<?php
if (!mysql_connect($host, $user, $pass)) {
    echo "Could not connect to MySQL";
    exit;
}
if (!mysql_select_db($dbname)) {
    echo "Could not select database ($dbname) : " . mysql_error();
    exit;
}

$sql = "SELECT id,username,password,status,notes 
        FROM assignment_one";
$result = mysql_query($sql);

if (!$result) {
    echo "Could not run query ($sql) : " . mysql_error();
    exit;
}

while ($row = mysql_fetch_assoc($result)) {
    extract($row);

    echo "| $id | $username | $password | $status | $notes |<br />\n";
}
?>

Regards,
Philip

--- End Message ---
--- Begin Message ---
 > echo("| %s | %s | %s | %s | %s |<br />", $array[id],
 > $array[username],
 > $array[password], $array[status], $array[notes]);

If you look at http://www.php.net/echo you'll see that echo
does not support this syntax. If you want to use this syntax
then you should probably be using some form of printf (see
http://www.php.net/printf).

CYA, Dave




--- End Message ---
--- Begin Message ---
On Sat, 1 Feb 2003, Hugh Danaher wrote:

> echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
> $array[password], $array[status], $array[notes]);
> 
> try
> echo "| %s | %s | %s | %s | %s |<br />".$array[id]." ".$array[username]."
> ".$array[password]." ".$array[status]." ".$array[notes];
> 
> dots not comas between variables.

echo takes on commas as we can echo multiple variables which 
isn't something we can do with print.  This is also the main
difference between echo and print.  So, the commas are okay
here but as someone else already stated, echo doesn't behave 
like printf so no special %formatting% with echo.

Regards,
Philip

--- End Message ---
--- Begin Message ---
hey guys
 
when you send me attachment,
It wont let me view the .dat file
what is that?
 
 
I tried to open with notepad and dreamweaver
but it wont view the code.
 
Karl
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here
--- End Message ---
--- Begin Message ---
I will be quick.

if
. matches any character except newline (by default)
then
what can i use to match any character INCLUDING newline?


--- End Message ---
--- Begin Message ---
Thank you chris,

Help full

Do you have any link for installation manual


"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 21:36 1-2-2003, you wrote:
> > > I am studying on php. And the book say, when the server see php
> > extension it
> > > is running php file and giving results to the visiting browser.
> > >
> > > But as I see related directories are normal directory, doesn' t like
> > cgi-bin
> > > directories.
> > >
> > > Is there any change to see php file source such as file open function
or
> > > something else? I am not going to somebody else file. Just I want to
be
> > sure
> > > how secure the php?
> >
> >It's all in CVS, read the source:
>
> I think he does not mean the PHP program source, but his scripts' source.
>
> Normally people cannot see the script source, as long as you use .php as
> file extension. In some PHP/server setups people can see the source when
> they type filename.phps, see the installation instruction file in the php
> package for details.
>
>


--- End Message ---
--- Begin Message ---
See www.php.net.



Qt wrote:
Thank you chris,

Help full

Do you have any link for installation manual


"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

At 21:36 1-2-2003, you wrote:

I am studying on php. And the book say, when the server see php
extension it

is running php file and giving results to the visiting browser.

But as I see related directories are normal directory, doesn' t like
cgi-bin

directories.

Is there any change to see php file source such as file open function

or

something else? I am not going to somebody else file. Just I want to

be

sure

how secure the php?
It's all in CVS, read the source:
I think he does not mean the PHP program source, but his scripts' source.

Normally people cannot see the script source, as long as you use .php as
file extension. In some PHP/server setups people can see the source when
they type filename.phps, see the installation instruction file in the php
package for details.





--- End Message ---
--- Begin Message ---
I am trying to load a php script to run in the background using the exec()
function. My code looks like this:

<?
// ....

    $aqid = $db->insert_id();    //grab  id of newly inserted row
    $cmd = "php -q sendit.php $aqid >/dev/null 2>&1 &";
    exec("$cmd");                    // call sendit.php in background
// ...
?>

Basically, the point of me doing this is so the script runs in the
background so the member does not have to wait for the script to run after
they have clicked a send button. But they are still waiting because they
can't go to other pages until the script has completed running.

My next alternative will be to run a cron job to do this instead. But I
can't get cron working just yet.  Any suggestions to get the script to run
in background without stalling the script that calls it?

--
Nicole




--- End Message ---
--- Begin Message --- Don't get your question right, but you get all your vars in the querystring after submitting the form. There, you should check on whether or not the var is filled (i.e. $var <> "" or so). There's no other way :-( so your guess is pretty ok.

BTW: use Javascript to modify the submitted values.


Edwin

Anders Thoresson wrote:
Hi,
I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled?
My guess is that I can do something like this:
if(!empty($f_name)) {
some_commands_to_add_$f_name_to_querystring
}
if(!empty($l_name)) {
some_commands_to_add_$f_name_to_querystring
}
some_commands_to_build_querystring_based_on_if's
$result = mysql_query($query)
But what commands/functions should I use to build the query?


--- End Message ---
--- Begin Message --- Helloo people,

I have to build a database abstraction class with support for XML output. My XML output has to look like this:

<?xml version="1.0" ?>
<result query="SELECT * FROM books">
<row number="1">
<field name="name">value</field>
<field name="name">value</field>
...
</row>
<row number="2">
<field name="name">value</field>
<field name="name">value</field>
...
</row>
....
....
</result>

Well i almost got it, but how do i get all the field names of my MySQL tables? This is my code, a part of my database class. :

/**

* getXMLDocument

*

* Get the result of your query back in XML document

* @author Davy Obdam

*/

function getXMLDocument() {

//Create XML document

if(!$this->xmlDoc = domxml_new_doc("1.0")) {

die("[ERROR] Cant create XML document");

}

// Create root element

$this->root_element = $this->xmlDoc->create_element("result");

$this->root_element->set_attribute("query", $this->sqlQuery);

//Get database fields and values

$count = 0;

while($this->fetchRow()) {

$row_element = $this->xmlDoc->create_element("row");

$n_row = $this->root_element->append_child($row_element);

$row_number = $row_element->set_attribute("number" ,$count);

$count++;

// Get fieldnames and values

for($i=0; $i<sizeof($this->sqlQuery); $i++) {

$field_element = $this->xmlDoc->create_element("field");

$n_field = $row_element->append_child($field_element);

$field_name = $field_element->set_attribute("name", "name");

$field_content = $field_element->append_child($this->xmlDoc->create_text_node(utf8_encode("text")));

}


$this->moveNext();

}

// Put everything together and show it

$append_root = $this->xmlDoc->append_child($this->root_element);

header("content-type:text/xml");

echo $this->xmlDoc->dump_mem();

}


Now all i get is one field <field name="name">whatever</field> in my XML output, but i should get 10 with this particular query.. Any help is appreciated, thanks for you time.

Best regards,

Davy Obdam
mailto:[EMAIL PROTECTED]


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

I building a form which will be used to set access rights to different parts of my web album. When editing the settings for each album, like the albums name and wether or not everyone should be allowed to upload pictures to it, I also present a list of checkboxes to the administrators. One checkbox for each registred user. If checked, to user is allowed to view the pictures, if not check, no pictures show.

The checkbox part of the form I build uses this code:

db_connect($dbuser, $dbpassword, $dbdatabase);
$query = "SELECT userid FROM members";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
echo($row[0]);
?>
<INPUT TYPE="checkbox" name="<?php echo($row[0])?>" VALUE="YES">


But how do I process this form when saving the settings for the album? For the forms I've built so far, I've known what information I can find in $_REQUEST['']. But this time, I don't know how many checkboxes there are, and what their names will be. How do I do this?

Is the form ok, or is a bad form design the reason I can't figure out what to form processing code should be?

--
anders thoresson
--- End Message ---
--- Begin Message ---
howabout making the checkboxes an array i.e.
<INPUT TYPE="checkbox" name="checkbox[<?php echo($row[0])?>]" VALUE="YES">

then when processing ...
foreach($_REQUEST["checkbox"] as $checkbox)
{    ...
}

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
----- Original Message -----
From: anders thoresson <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 02, 2003 12:28 PM
Subject: [PHP] processing form with unknown number of checkboxes, each with
a unknown name.


> Hi,
>
>  I building a form which will be used to set access rights to different
> parts of my web album. When editing the settings for each album, like the
> albums name and wether or not everyone should be allowed to upload
pictures
> to it, I also present a list of checkboxes to the administrators. One
> checkbox for each registred user. If checked, to user is allowed to view
> the pictures, if not check, no pictures show.
>
>  The checkbox part of the form I build uses this code:
>
> db_connect($dbuser, $dbpassword, $dbdatabase);
> $query = "SELECT userid FROM members";
> $result = mysql_query($query);
> while($row = mysql_fetch_array($result)) {
> echo($row[0]);
> ?>
> <INPUT TYPE="checkbox" name="<?php echo($row[0])?>" VALUE="YES">
>
>
>  But how do I process this form when saving the settings for the album?
For
> the forms I've built so far, I've known what information I can find in
> $_REQUEST['']. But this time, I don't know how many checkboxes there are,
> and what their names will be. How do I do this?
>
>  Is the form ok, or is a bad form design the reason I can't figure out
what
> to form processing code should be?
>
> --
> anders thoresson
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to