Re: [PHP-DB] Get a single result

2002-10-03 Thread Petr Tomenendál

Hi,
change line 170 to this:
$form_category_id[$i] = mysql_result($result_category_id, 0, 0);

In each iteration your program executes new SQL query, which
selects only one column from table, and i think, it selects only one row
too. So you have to select first column from first row. With your
code: mysql_result($result_category_id, 0, $i); you try to get value
from first row but from columns 1,2,3,4,5... etc. as for runs through
array. 

Hope this helps.

Petr Tomenendal.




On Wed, 2002-10-02 at 18:57, Wilmar Perez wrote:
 Hello guys.
 
 The scenery:  I've got an array with some values stored in it.  I want to 
 retrieve the id code each value is associated to.  So I just do the following:
 
 for ($i=0; $icount($form_category);$i++)
 {
 $query_get_id = select cat_code from categories 
where cat_name like '$form_category[$i]';
 $result_category_id = mysql_query($query_get_id) or die(mysql_error());
 $form_category_id[$i] = mysql_result($result_category_id, 0, $i); //This
   is line
   170
 echo $form_category[$i]. .$form_category_id[$i].br;
 }
 
 I'm getting the following in my browser  (There are some comments I just 
 added):
 
 Arquitectura 2  //This is the correct category name and its ID
 
 Warning: Bad column offset specified 
 in /var/www/bva/new/common/scripts/admin_functions.php on line 170
 Caricatura //This is the correct category name but the ID is lost
 
 Warning: Bad column offset specified 
 in /var/www/bva/new/common/scripts/admin_functions.php on line 170
 Ciencias naturales //Same as before
 
 Any idea of what I'm doing wrong?
 
 ***
  Wilmar Prez
  Network Administrator
Library System
   Tel: ++57(4)2105145
 University of Antioquia
Medelln - Colombia
   2002
 ***
  
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



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




[PHP-DB] The noob is back! About this directory security...

2002-10-03 Thread Brett Lathrope


I want to thank everyone that helped me with phpMyAdmin suggestions.  It
took me 6 and a half hours to get it to work, but I got it to work!  LOL!
You guys have no idea how confusing the configuration file is for some that
is new to php and doesn't know unix.

And that leads me to my question.

I have a directory where I put phpMyAdmin, how to I keep everyone out but
me...yet still be able to access it myself.

Also, when I create my PHP scripts to access this database (which I've
actually done) I want to put them in a directory that is safe from prying
eyes but usable by those coming in through the browser (if that makes
sense).

You guys keep talking about this chmod command...but I'm using WS-FTP LE and
all I get is Owner, Group, and Other with the options to set Read, Write and
Execute for each.

And I've read that I should be 2 directories down?

Thanks guys.

Brett


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




[PHP-DB] LOAD DATA INFILE

2002-10-03 Thread Karel

hi, could you help me?

i have got this php code

$importfilename = $importdir_web . $importfile;
echo $importfilename . 'br';
$vysledekupdate = MySQL_DB_Query($dbname,LOAD DATA LOCAL INFILE
'$importfilename' INTO TABLE shop_rates FIELDS TERMINATED BY ';' LINES
TERMINATED BY '\r\n');
if ($vysledekupdate == false) echo 'br' . MySQL_Error() . 'brbr';
else echo 'Import ok.brbr';

$cenaquery = MySQL_DB_Query($dbname,SELECT * FROM shop_rates);
if ($cenaquery == false) echo MySQL_Error() . 'br';

echo 'Updated:br';
echo 'table';
while ($zaznamcena = MySQL_Fetch_Array($cenaquery)) :
{
echo 'trtd' . $zaznamcena[id_item] . '/tdtd' . $zaznamcena[c1] .
'/tdtd' . $zaznamcena[c2] . '/tdtd' . $zaznamcena[c3] . '/tdtd'
. $zaznamcena[c4] . '/tdtd' . $zaznamcena[dph] . '/tdtd' .
$zaznamcena[jednotka] . '/td/tr';
}
endwhile;
echo '/table';

content of the file
/home/abianet/e.abianet.cz/importc/1033573485.obabia.www.sql
just two rows

19;20500;19400;0;0;22;ks
17;2;19900;0;0;22;ks

table shop_rates structure
id_item, c1, c2, c3, c4, dph, jednotka

this is the web/html output
/home/abianet/e.abianet.cz/importc/1033573485.obabia.www.sql
Import ok.
Updated:
17 10440.00 0.00 0.00 0.00 22 ks
19 0.00 0.00 0.00 0.00 22 ks

so that means tha import wasnot ok

could you help me?

thanks karel



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




[PHP-DB] Re: The noob is back! About this directory security...

2002-10-03 Thread Leendert


Brett Lathrope [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I want to thank everyone that helped me with phpMyAdmin suggestions.  It
 took me 6 and a half hours to get it to work, but I got it to work!  LOL!
 You guys have no idea how confusing the configuration file is for some
that
 is new to php and doesn't know unix.

 And that leads me to my question.

 I have a directory where I put phpMyAdmin, how to I keep everyone out but
 me...yet still be able to access it myself.

You can use .htaccess to secure your directory with a user/pass.
http://www.google.com/search?q=htaccess+tutorial


 Also, when I create my PHP scripts to access this database (which I've
 actually done) I want to put them in a directory that is safe from prying
 eyes but usable by those coming in through the browser (if that makes
 sense).

Not quite sure what you mean. If you mean people aren't allowed to read your
code: surprise, that's not possible given your PHP configuration is set up
correctly.


 You guys keep talking about this chmod command...but I'm using WS-FTP LE
and
 all I get is Owner, Group, and Other with the options to set Read, Write
and
 Execute for each.

That is pretty much what chmod does. I think it will become clearer if you
read some about chmod.
http://www.google.com/search?q=chmod+tutorial


 And I've read that I should be 2 directories down?

Don't believe everything they tell you. (More seriously: I have no idea what
you mean by that.)


 Thanks guys.

 Brett




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




RE: [PHP-DB] Re: The noob is back! About this directory security...

2002-10-03 Thread Griffiths, Daniel

you could put your php scipts that contain senstive stuff like database logins and 
passwords etc in a dir thats not under the public_html dir (or whatever yours is) i.e. 
under your root you might have 'public_html', 'tmp', 'cgi-bin' etc. create a dir and 
call it what you like ('php' would do) and put your scripts in there. when you need to 
use them on a page put this code in 

?
ini_set('include_path', '../php');
require 'your_php_script.php';
?

../ tells the script to look up a dir so ../../ would go up 2 etc

hope this makes sense

Dan


-Original Message-
From: Leendert [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 10:00
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: The noob is back! About this directory security...



Brett Lathrope [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I want to thank everyone that helped me with phpMyAdmin suggestions.  It
 took me 6 and a half hours to get it to work, but I got it to work!  LOL!
 You guys have no idea how confusing the configuration file is for some
that
 is new to php and doesn't know unix.

 And that leads me to my question.

 I have a directory where I put phpMyAdmin, how to I keep everyone out but
 me...yet still be able to access it myself.

You can use .htaccess to secure your directory with a user/pass.
http://www.google.com/search?q=htaccess+tutorial


 Also, when I create my PHP scripts to access this database (which I've
 actually done) I want to put them in a directory that is safe from prying
 eyes but usable by those coming in through the browser (if that makes
 sense).

Not quite sure what you mean. If you mean people aren't allowed to read your
code: surprise, that's not possible given your PHP configuration is set up
correctly.


 You guys keep talking about this chmod command...but I'm using WS-FTP LE
and
 all I get is Owner, Group, and Other with the options to set Read, Write
and
 Execute for each.

That is pretty much what chmod does. I think it will become clearer if you
read some about chmod.
http://www.google.com/search?q=chmod+tutorial


 And I've read that I should be 2 directories down?

Don't believe everything they tell you. (More seriously: I have no idea what
you mean by that.)


 Thanks guys.

 Brett




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


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




[PHP-DB] Returning text fields with PHP from MS SQL

2002-10-03 Thread Gard Rødahl

I get the following error:

Warning: MS SQL message: Unicode data in a Unicode-only collation or ntext
data cannot be sent to clients using DB-Library (such as ISQL) or ODBC
version 3.7 or earlier.

when running a query from the php script.
One of the fields in the table being queried is of a NTEXT type which it has
to be.
How can i work around this problem? I've tried to set the textsize and
textlimit to 65536 in the php.ini file, and run set textsize 65536 in the
sql query
but I still get the same error message.

Thanks
Gard



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.393 / Virus Database: 223 - Release Date: 30.09.2002



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




RE: [PHP-DB] Re: Mail problem

2002-10-03 Thread Snijders, Mark

I also have such a script, but i use perl, but there are no difference..

use a for or while loop

and put a sleep() function or another function in the loop.. so the server
has more time to process the mail, and there will be no timeout anymore


Mark SNijders



-Original Message-
From: Mak [mailto:[EMAIL PROTECTED]]
Sent: woensdag 2 oktober 2002 16:48
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Mail problem


Beware though...if there are too many addresses in the db, you may encounter
timeouts, or your browser may crash (very likely). Increase the timeout
before you do such a mass-mail job.

Also, my comment: If you do not want your receivers to find out who else you
sent the mail to, don't use the CC method. Just:

for(until max. users reached){
send out new mail to current user
}

Yours sincerely,
Mak

Jj Harrison\ [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  maybe use a for loop and mail command.
  should work

 Or put all the addresses in a CC/BCC field maybe sending every 100 emails
to
 prevent a mail overload/blockage due to to many recipients etc.

 Hint: look here: http://www.php.net/manual/en/language.variables.php and
you
 can find a way to append more to an existing variable. Very useful in your
 case.


 --
 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com

  Unknown Sender [EMAIL PROTECTED] wrote in message
  002701c23924$da9b1e40$539f4dd5@administrator">news:002701c23924$da9b1e40$539f4dd5@administrator...
  Sorry to be a little bit off topic.
 
  I need a tool or script in PHP, that will automaticaly send e-mails to
  receipients taken from database.
  For example 1 the same e-mail to 1000 receipients. B
 
  Mail server is on different machine.
 
  Thanks in advance
 
 
 





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


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




[PHP-DB] deleting a file

2002-10-03 Thread Karel

hi how do i delete a file from server using php?

thanks

karel

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




Re: [PHP-DB] deleting a file

2002-10-03 Thread Jeffrey_N_Dyke


unlink()

|---|
|  Jeff | KeaneIT - Presidents  |
|  Landing | Suite: 200 |
|Outside: 617 -517-1772 |   |
|  E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents   |
| Landing  Medford, MA 02155 USA|
|   ]   |
|---|





   
 
Karel
 
[EMAIL PROTECTED]   To: [EMAIL PROTECTED]
 
cc:   
 
 Subject: [PHP-DB] deleting a file 
 
10/03/2002 
 
08:16 AM   
 
Please respond 
 
to karel   
 
   
 
   
 




hi how do i delete a file from server using php?

thanks

karel

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





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




RE: [PHP-DB] deleting a file

2002-10-03 Thread Snijders, Mark

first try to search more on php.net


and for this time: use unlink();



-Original Message-
From: Karel [mailto:[EMAIL PROTECTED]]
Sent: donderdag 3 oktober 2002 14:16
To: [EMAIL PROTECTED]
Subject: [PHP-DB] deleting a file


hi how do i delete a file from server using php?

thanks

karel

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


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




[PHP-DB] Showing multiple option list from db query?

2002-10-03 Thread Dave Carrera

Hi All

I have a database (mysql) that has some rows entered.

Format:
Name | Desription | catid

This has some info in it like this

Joe Man 1
Jack Man 1
Jacky Female 2
Emily Female 2

What I am trying to do is create dynamically created select lists so
that all with catid 1 are in the fisrt select list and all with catid 2
are in a separate second list and so on.

I have it nearly working but the first list gives the cadid 1 result the
second gives catid 1 and catid 2 result and so on.

So how would I split the results?

As always I thank anyone who helps me with this issue fully in advance.

Dave C


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




[PHP-DB] Table question....

2002-10-03 Thread Rodrigo

Hi people, is there a way to print a table with the background switching colors??? 
like one blue, the next black, blue, black...

thanks in advance...  Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 




Re: [PHP-DB] Table question....

2002-10-03 Thread Jeffrey_N_Dyke


if you mean the rows switching colors i use this.  in this example i'm
getting data from mysql

$rs = 0;
for($i = 0; $i  count($rs); ) {
 while ($rs = mysql_fetch_array($result)) {
  $bgcolor = ($i % 2) ? 'blue' : 'black';
  //do stuff
 $i++;
 }
}

then $bgcolor goes in each td bgcolor=$bgcolor ...

hth
jd


   

Rodrigo  

rodrigo@praticsistem   To: PHP [EMAIL PROTECTED]   

as.com.br  cc:

Subject: [PHP-DB] Table 
question   
10/03/2002 08:59 AM

Please respond to  

Rodrigo  

   

   





Hi people, is there a way to print a table with the background switching
colors??? like one blue, the next black, blue, black...

thanks in advance...  Equipe Pratic Sistemas
   Rodrigo Corrêa
   Fone: (14) 441-1700
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]






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




RE: [PHP-DB] Table question....

2002-10-03 Thread Snijders, Mark

you have to make it yourself...

make a counter, for every row do $counter++;

and the

if ($counter%2==0){
blue

}else{
red
}


the % is the difference math function... you got a rest-value or not...

hope you get it :)

-Original Message-
From: Rodrigo [mailto:[EMAIL PROTECTED]]
Sent: donderdag 3 oktober 2002 14:30
To: PHP
Subject: [PHP-DB] Table question


Hi people, is there a way to print a table with the background switching
colors??? like one blue, the next black, blue, black...

thanks in advance...  Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 



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




RE: [PHP-DB] Sending E-Mail

2002-10-03 Thread Hutchins, Richard

FYI...

Not sure what your intentions are, but you can also send the form data from
ANY form by putting the mailto:[EMAIL PROTECTED] statement in the action
property of the form and using the POST method (I don't think it'll work
with GET).

You'll generate an e-mail with an attachment that contains your data in
name=value pairs and you'll have to parse through the file to get the
individual values. I tried it with one of my forms and got this in the
attached file:

docnum=6contentID=1addItem=itemList%5B%5D=0itemList%5B%5D=1itemList%5B%
5D=2submit=Submit+Query

Note: The names itemList were submitted from a multiple select object.

Whether you use the php mail() function or plain, old HTML mailto: is up to
you and your specific needs. My guess, having never used php's mail() is
that you'll get a little more functionality/flexibility from it. As always,
your mileage may vary.

 -Original Message-
 From: tuxen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 03, 2002 1:27 PM
 To: PHP Database List
 Subject: Re: [PHP-DB] Sending E-Mail
 
 
 just put the variables from the form into the mail() function
 
 On Wed, 2002-10-02 at 23:11, Shoulder to Shoulder Farm wrote:
  Sorry all, this IS off topic, but I always receive faster 
 answers from 
  this group :-o!
  How can I send e-mail from PHP with the content of a submitted form.
  Thanks, Taj
  
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP-DB] Table question....

2002-10-03 Thread 1LT John W. Holmes

$bgcolor = ($count++  1) ? blue : black;

Then use $bgcolor in your tr

---John Holmes...

- Original Message -
From: Rodrigo [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Thursday, October 03, 2002 8:29 AM
Subject: [PHP-DB] Table question


Hi people, is there a way to print a table with the background switching
colors??? like one blue, the next black, blue, black...

thanks in advance...  Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED]




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




Re: [PHP-DB] Showing multiple option list from db query?

2002-10-03 Thread 1LT John W. Holmes

 I have a database (mysql) that has some rows entered.

 Format:
 Name | Desription | catid

 This has some info in it like this

 Joe Man 1
 Jack Man 1
 Jacky Female 2
 Emily Female 2

 What I am trying to do is create dynamically created select lists so
 that all with catid 1 are in the fisrt select list and all with catid 2
 are in a separate second list and so on.

 I have it nearly working but the first list gives the cadid 1 result the
 second gives catid 1 and catid 2 result and so on.

 So how would I split the results?

?
$result = mysql_query(SELECT * FROM table);
while($row = mysql_fetch_assoc($result))
{ $option[$row['catid']] = option
value='{$row['Name']}'{$row['Name']}/option\n; }

Then use $option[1] and $option[2] in your different select boxes.

select name=male
?=$option[1]?
/select

---John Holmes...


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




[PHP-DB] Pulling apart select list elements

2002-10-03 Thread Hutchins, Richard

OK, so this probably is a bit off topic, but the results of these actions
will be placed into a MySQL database. Close enough?

I have a select multiple/select object named list[] that is passing its
selected contents to an array. That part works fine. I can use a for loop to
grab all of the selected items. Where I'm stuck is that I want to get both
the value AND the text for any given option element and simply numbering
the items in the array 1-N based on the number of rows is not sufficient.

Example:

select name=itemList[] multiple
option value=101PHP For Dummies/option
option value=102PHP For Professionals/option
option value=103PHP For Gurus/option
/select

I want to be able to be able to get both the value property (101, 102, ...)
AND the text between the option/option tags. Currently, I'm only getting
the text between the option/option tags. Is there a PHP function that
allows me to get to both?

The code I use to get the contents of the array is as follows and it works
fine:
$numrows = count($_POST[itemList]);

for ($i = 0;$i  $numrows; $i++)
{
$thisItem = $_POST[itemList][$i];
$thisOrdinal = $i;
$sql=INSERT INTO leveltwo (2contentID, parentID, 2content,
2ordinal) VALUES ('Null','$parentContentID','$thisItem','$thisOrdinal');
echo (pItem .$i. in the list is:
.$_POST[itemList][$i]./p);
echo ($sql);
$result=mysql_query($sql)
or die(mysql_error());
echo (Insert done. Click a
href=\../public/contentMgr.html\here./a);

The general idea behind the functionality I'm after is that the user is
presented with a select list of items. The user then can reorder the items
to his liking and can alter the text of the individual select items. But I
need to preserve the original ID of the individual select items before the
user reordered or altered the text. That original value will be included in
the WHERE clause of the SQL query in the code above. All of the moving and
editing stuff works via JS. I'm just stuck on how to get the value AND the
text from each option. I searched the archives first and got close, but no
cigar.

Any help is appreciated.

Rich Hutchins
Sr. Technical Writing Administrator
Getinge/Castle, Inc.
1777 E. Henrietta Rd.
Rochester NY 14623
585-272-5072


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




[PHP-DB] Function help....

2002-10-03 Thread Rodrigo

Hi people, i wanna know from you if this is the way to complete a filed with zeros 
0...

if i type 01 it completes to 0001




function zero4($campo) {

if(strlen($campo) == 4) {

 $status = ok;

}else{

while(strlen($campo)  4) {

$campo = 0 . $campo;

}
}
}
what do you think?





Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 




RE: [PHP-DB] Function help....

2002-10-03 Thread Aaron Wolski

Why don't you just try it and see?

Aaron

-Original Message-
From: Rodrigo [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 1:41 PM
To: PHP
Subject: [PHP-DB] Function help


Hi people, i wanna know from you if this is the way to complete a filed
with zeros 0...

if i type 01 it completes to 0001




function zero4($campo) {

if(strlen($campo) == 4) {

 $status = ok;

}else{

while(strlen($campo)  4) {

$campo = 0 . $campo;

}
}
}
what do you think?






Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 



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




[PHP-DB] Form Handler

2002-10-03 Thread Gil Merkle

I'm new at PHP and am trying to get a simple form handler to work.  (I do
use the PEAR classes; but, haven't done much with them yet).  I have the
following simple form (form1) and handler.  The field 'FName' does not
display in the handler.  What have I missed?

Form:

HTML
HEAD
TITLEForm 1 test/TITLE
/HEAD
 BODY
 FORM METHOD=POST ACTION=form1handler.php
 First Field is:br
 PINPUT TYPE=TEXT NAME=FName SIZE=20/p
 INPUT TYPE=submit
 INPUT TYPE=reset
 /FORM
 /BODY
 /HTML

Handler:

HTML
HEAD
TITLEFormhandler 1 test/TITLE
/HEAD
 BODY
 ?php
   print(Hi br);
   print(Field1 is: $FName);
 ?
 /BODY
 /HTML



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




Re: [PHP-DB] Form Handler

2002-10-03 Thread Jeffrey_N_Dyke


register_globals=off in your php.ini

turn it on, or use $_POST['FName']
|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|





   
 
  Gil Merkle 
 
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]  
 
   cc: 
 
  10/03/2002 04:18 Subject:  [PHP-DB] Form Handler 
 
  PM   
 
   
 
   
 




I'm new at PHP and am trying to get a simple form handler to work.  (I do
use the PEAR classes; but, haven't done much with them yet).  I have the
following simple form (form1) and handler.  The field 'FName' does not
display in the handler.  What have I missed?

Form:

HTML
HEAD
TITLEForm 1 test/TITLE
/HEAD
 BODY
 FORM METHOD=POST ACTION=form1handler.php
 First Field is:br
 PINPUT TYPE=TEXT NAME=FName SIZE=20/p
 INPUT TYPE=submit
 INPUT TYPE=reset
 /FORM
 /BODY
 /HTML

Handler:

HTML
HEAD
TITLEFormhandler 1 test/TITLE
/HEAD
 BODY
 ?php
   print(Hi br);
   print(Field1 is: $FName);
 ?
 /BODY
 /HTML



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






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




RE: [PHP-DB] Pulling apart select list elements

2002-10-03 Thread John W. Holmes

 I have a select multiple/select object named list[] that is
passing
 its
 selected contents to an array. That part works fine. I can use a for
loop
 to
 grab all of the selected items. Where I'm stuck is that I want to get
both
 the value AND the text for any given option element and simply
numbering
 the items in the array 1-N based on the number of rows is not
sufficient.
 
 Example:
 
 select name=itemList[] multiple
   option value=101PHP For Dummies/option
   option value=102PHP For Professionals/option
   option value=103PHP For Gurus/option
 /select
 
 I want to be able to be able to get both the value property (101, 102,
 ...)
 AND the text between the option/option tags. Currently, I'm only
 getting
 the text between the option/option tags. Is there a PHP function
that
 allows me to get to both?

No, you only get the value= part. I think your confused, or this isn't
the correct code, when you say your are getting what's between
option/option then you're doing something different.

Bottom line, you only get the value part. If you want two values passed,
then use some hidden elements to relate the values.

input type=hidden name=itemListtext[101] value=PHP For Dummies

would relate to your first element. So in PHP, you'd have

$_POST['itemList'][0] == 101
and
$_POST['itemListtext'][$_GET['itemList'][0]] == PHP For Dummies

If you're using your database correctly, all you should need is the
number, anyhow...

---John Holmes...



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




RE: [PHP-DB] Function help....

2002-10-03 Thread John W. Holmes

Sprintf() or printf() would be better...

---John Holmes...

 -Original Message-
 From: Rodrigo [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 03, 2002 1:41 PM
 To: PHP
 Subject: [PHP-DB] Function help
 
 Hi people, i wanna know from you if this is the way to complete a
filed
 with zeros 0...
 
 if i type 01 it completes to 0001
 
 
 
 
 function zero4($campo) {
 
 if(strlen($campo) == 4) {
 
  $status = ok;
 
 }else{
 
 while(strlen($campo)  4) {
 
 $campo = 0 . $campo;
 
 }
 }
 }
 what do you think?
 
 
 
 


--
 --
 Equipe Pratic Sistemas
 Rodrigo Corrêa
 Fone: (14) 441-1700
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 




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




RE: [PHP-DB] Pulling apart select list elements

2002-10-03 Thread Jason Vincent

There is another way -- I sometimes do this...

you can have both the id and text in the value like so...

select
option value=1--product1Product 1
option value=2--another productAnother product
etc...

then parse through the value list and split it on --

foreach ($listOfProducts as $prod){
if (!$prod){break;}
list ($productID,$productName) = split(--,$prod);
}


J

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 7:57 PM
To: 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Pulling apart select list elements


 I have a select multiple/select object named list[] that is
passing
 its
 selected contents to an array. That part works fine. I can use a for
loop
 to
 grab all of the selected items. Where I'm stuck is that I want to get
both
 the value AND the text for any given option element and simply
numbering
 the items in the array 1-N based on the number of rows is not
sufficient.
 
 Example:
 
 select name=itemList[] multiple
   option value=101PHP For Dummies/option
   option value=102PHP For Professionals/option
   option value=103PHP For Gurus/option
 /select
 
 I want to be able to be able to get both the value property (101, 102,
 ...)
 AND the text between the option/option tags. Currently, I'm only 
 getting the text between the option/option tags. Is there a PHP 
 function
that
 allows me to get to both?

No, you only get the value= part. I think your confused, or this isn't the
correct code, when you say your are getting what's between option/option
then you're doing something different.

Bottom line, you only get the value part. If you want two values passed,
then use some hidden elements to relate the values.

input type=hidden name=itemListtext[101] value=PHP For Dummies

would relate to your first element. So in PHP, you'd have

$_POST['itemList'][0] == 101
and
$_POST['itemListtext'][$_GET['itemList'][0]] == PHP For Dummies

If you're using your database correctly, all you should need is the number,
anyhow...

---John Holmes...



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




RE: [PHP-DB] Pulling apart select list elements

2002-10-03 Thread Rich Hutchins

John is right, of course, I was only getting the value. I had it
bass-acwards in the original post. Since the end-all answer is that the
select only passes the value, I'll have to rethink my use of the control.

Thanks, John.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 7:57 PM
To: 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Pulling apart select list elements


 I have a select multiple/select object named list[] that is
passing
 its
 selected contents to an array. That part works fine. I can use a for
loop
 to
 grab all of the selected items. Where I'm stuck is that I want to get
both
 the value AND the text for any given option element and simply
numbering
 the items in the array 1-N based on the number of rows is not
sufficient.

 Example:

 select name=itemList[] multiple
   option value=101PHP For Dummies/option
   option value=102PHP For Professionals/option
   option value=103PHP For Gurus/option
 /select

 I want to be able to be able to get both the value property (101, 102,
 ...)
 AND the text between the option/option tags. Currently, I'm only
 getting
 the text between the option/option tags. Is there a PHP function
that
 allows me to get to both?

No, you only get the value= part. I think your confused, or this isn't
the correct code, when you say your are getting what's between
option/option then you're doing something different.

Bottom line, you only get the value part. If you want two values passed,
then use some hidden elements to relate the values.

input type=hidden name=itemListtext[101] value=PHP For Dummies

would relate to your first element. So in PHP, you'd have

$_POST['itemList'][0] == 101
and
$_POST['itemListtext'][$_GET['itemList'][0]] == PHP For Dummies

If you're using your database correctly, all you should need is the
number, anyhow...

---John Holmes...



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


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