php-windows Digest 23 Nov 2004 15:57:20 -0000 Issue 2480

Topics (messages 25027 through 25034):

Re: What's wrong with these two programs?
        25027 by: Armando
        25028 by: Michael Purdy
        25032 by: Gryffyn, Trevor

Re: Passing an Array in HTML
        25029 by: Michael Adams
        25031 by: Gryffyn, Trevor
        25033 by: Wagner, Aaron

Ldap Help for connect to PhPNuke
        25030 by: eric LUDINART

Login from phpmyadmin to mysql error.
        25034 by: xirzop.hotpop.com

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 ---
Anthony, there is nothing wrong with what you've done, but try changing
your 'print' line in hiUser.php to:

print "<h3>Hi there, ". $_POST["userName"] ."</h3>";

And it should now work. Cheers.

Armando

-----Original Message-----
From: aomarlow [mailto:[EMAIL PROTECTED] 
Sent: November 22, 2004 9:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] What's wrong with these two programs?


Hi,
 
Can anyone tell me what's wrong with the two following programs?  The
first (whatsName.html) is straight HTML, and is supposed to build a form
that asks a question.  The second program, (hiUser.php) is supposed to
read the value input by the user, and process it.  I'm not having any
trouble with the first program, but when the second program runs, it
prints out code, rather than getting the result that it is supposed to
get.
 
Have I linked the two programs in the wrong way, or
something like that?  BTW, both of these programs are
sample programs from the book, "PHP 5/MySQL
Programming for the Absolute Beginner."
 
Here are the two programs:
 
1.)  whatsName.html:
 
<html>
<head>
<title>What's your name?</title>
</head>
<body>
 
<h1>What's your name?</h1>
<h3>Writing a form for user input</h3>
 
  <form method = "post"
        action = "hiUser.php">
  Please type your name:
  <input type = "text"
  name = "userName"
  value = "">

   <br>
   <input type = "submit">
   
   </form>
   
</body>
</html>
 
Here is program #2.) hiUser.php:
 
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1>
<h3>PHP program that receives a value from
"whatsName"</h3>
 
<?
  print "<h3>Hi there, $userName!</h3>";
    
?>
  
</body>
</html>
 
Your help is always appreciated!
Anthony
 



                
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 

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

--- End Message ---
--- Begin Message ---
Anthony

Assuming you have not omitted any of the code for script 2:

You need to have a get the posted value at the start of script 2 i.e.

$username = $_REQUEST['userName'];

Mike

----- Original Message ----- 
From: "aomarlow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 23, 2004 1:36 PM
Subject: [PHP-WIN] What's wrong with these two programs?


> Hi,
> 
> Can anyone tell me what's wrong with the two following
> programs? The first (whatsName.html) is straight
> HTML, and is supposed to build a form that asks a
> question. The second program, (hiUser.php) is
> supposed to read the value input by the user, and
> process it. I'm not having any trouble with the first
> program, but when the second program runs, it prints
> out code, rather than getting the result that it is
> supposed to get.
> 
> Have I linked the two programs in the wrong way, or
> something like that? BTW, both of these programs are
> sample programs from the book, "PHP 5/MySQL
> Programming for the Absolute Beginner."
> 
> Here are the two programs:
> 
> 1.) whatsName.html:
> 
> <html>
> <head>
> <title>What's your name?</title>
> </head>
> <body>
> 
> <h1>What's your name?</h1>
> <h3>Writing a form for user input</h3>
> 
> <form method = "post"
> action = "hiUser.php">
> Please type your name:
> <input type = "text"
> name = "userName"
> value = "">
> 
> <br>
> <input type = "submit">
> 
> </form>
> 
> </body>
> </html>
> 
> Here is program #2.) hiUser.php:
> 
> <html>
> <head>
> <title>Hi User</title>
> </head>
> <body>
> <h1>Hi User</h1>
> <h3>PHP program that receives a value from
> "whatsName"</h3>
> 
> <?
> print "<h3>Hi there, $userName!</h3>";
> 
> ?>
> 
> </body>
> </html>
> 
> Your help is always appreciated!
> Anthony
> 
> 
> 
> 
> 
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - Get yours free! 
> http://my.yahoo.com 
>  
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Check out the other responses, but another thought is that you may not have 
your web server configured to process .PHP files properly.  If it thinks it's a 
text file, it won't pass it through the PHP script interpreter.  Go back over 
the instructions for installing PHP on your web server and make sure that you 
have .PHP and it's associated MIME type pointing to your php.exe for processing.

If you need specifics, check the PHP Installation instructions or post another 
note to the list.  Sorry, I don't have enough time right now to dig up the 
info.  Just wanted to point you in that direction as a possibility.

-TG

> -----Original Message-----
> From: aomarlow [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 10:36 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] What's wrong with these two programs?
> 
> 
> Hi,
>  
> Can anyone tell me what's wrong with the two following
> programs?  The first (whatsName.html) is straight
> HTML, and is supposed to build a form that asks a
> question.  The second program, (hiUser.php) is
> supposed to read the value input by the user, and
> process it.  I'm not having any trouble with the first
> program, but when the second program runs, it prints
> out code, rather than getting the result that it is
> supposed to get.
>  
> Have I linked the two programs in the wrong way, or
> something like that?  BTW, both of these programs are
> sample programs from the book, "PHP 5/MySQL
> Programming for the Absolute Beginner."
>  
> Here are the two programs:
>  
> 1.)  whatsName.html:
>  
> <html>
> <head>
> <title>What's your name?</title>
> </head>
> <body>
>  
> <h1>What's your name?</h1>
> <h3>Writing a form for user input</h3>
>  
>   <form method = "post"
>         action = "hiUser.php">
>   Please type your name:
>   <input type = "text"
>   name = "userName"
>   value = "">
> 
>    <br>
>    <input type = "submit">
>    
>    </form>
>    
> </body>
> </html>
>  
> Here is program #2.) hiUser.php:
>  
> <html>
> <head>
> <title>Hi User</title>
> </head>
> <body>
> <h1>Hi User</h1>
> <h3>PHP program that receives a value from
> "whatsName"</h3>
>  
> <?
>   print "<h3>Hi there, $userName!</h3>";
>     
> ?>
>   
> </body>
> </html>
>  
> Your help is always appreciated!
> Anthony
>  
> 
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - Get yours free! 
> http://my.yahoo.com 
>  
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Mon, 22 Nov 2004 16:12:37 -0800
"Vail, Warren" <[EMAIL PROTECTED]> wrote:

> Only real array I've ever seen in HTML is one passed to JavaScript. 
> Anyone else found another way?
> 
> I suppose you could do it as a pull down list (preselecting all
> selections), but risk is your user will screw up the data by clicking
> on the list, but that struck me as kind of hokey (a technical term if
> the highest order ;-).
> 
> Warren Vail
> 
> 
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > Sent: Monday, November 22, 2004 4:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Re: Passing an Array in HTML
> > 
> > 
> > So the only way to do it is by separating all of the elements 
> > instead of sending it as one big array?  Hmmm.  There is no 
> > better way to pass an array?
> > 
> > Thanks.
> > 
> > Mike
> > 
> > 
> > "Vail, Warren" <[EMAIL PROTECTED]> wrote in message 
> > news:[EMAIL PROTECTED]
> > ab.com...
> > > You can pass array data by adding it to the form (probably 
> > not a good 
> > > practice, I would choose sessions to pass the data, but incase you
> > > have
> > some
> > > need that is ok, try the following);
> > >
> > > // To add the data to your form;
> > >
> > > Foreach($data_old as $k => $v) echo "<input type=hidden 
> > > name=\"dataold[".$k."]\" value = \"".$v."\">\n";
> > >
> > > // to get the data returned from the form add the following to the
> > > module specified in the form action field
> > >
> > > $data_old = $_POST["dataold"];
> > >
> > > // $data_old now contains the array contents
> > >
> > > Haven't tried this but I suspect it should work; anyone aware of a
> > > limit
> > on
> > > the number of hidden elements in a form?
> > >
> > > Hope this helps,
> > >
> > > Warren Vail
> > >
> > >
> > > > -----Original Message-----
> > > > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > > > Sent: Monday, November 22, 2004 3:50 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] Passing an Array in HTML
> > > >
> > > >
> > > > I am reading a file into an array ($data_old =
> > > > file("config.old");) and then processing it as I receive 
> > information 
> > > > from the user.  As we all know, the Internet is 
> > stateless, so I need 
> > > > to read back in the array after I get my answer.
> > > >
> > > > Array definitions are
> > > >
> > > > $data_old = array();
> > > > $data_new = array();
> > > > $data_count = 0;
> > > >
> > > > The output code is
> > > >
> > > > echo "<P><input type='hidden' name='data_old' 
> > > > value='".$data_old."'>"; echo "<P><input type='hidden' 
> > > > name='data_old' value='".$data_new."'>"; echo "<P><input 
> > > > type='hidden' name='data_count' value=".$data_count.">";
> > > >
> > > > and the input code is
> > > >
> > > > $data_old = $_REQUEST['data_old'];
> > > > $data_new = $_REQUEST['data_new'];
> > > > $data_count = $_REQUEST['data_count'];
> > > >
> > > > $data_count is working so I am assuming my problem is the 
> > way that I 
> > > > am passing the array.  How can I pass an array or is it not 
> > > > possible?  I would think that anything can be passed as 
> > it is just 
> > > > bits of data (pun intended). So what goes out should come 
> > in.  But, 
> > > > for some reason, that is not happening.
> > > >
> > > > Any help, suggestions, and guidance is appreciated.
> > > >
> > > > Mike
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > 
> > -- 
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

If you set it up properly it can be echoed into the header as
a javascript array and acted on from there.

Compare -
var foo = new Array(
        new Array("data1","data2","data3"),
        new Array("data4","data5","data6"),
        new Array("data7","data8","data9")
        );
bar = foo[2][1];

With -
var foo = new Array(
        <?php fm happens here which gets sent as identical to the above?>
        );
bar = foo[2][1];

Michael Adams

--- End Message ---
--- Begin Message ---
Yeah, I wouldn't recommend passing an array via an HTML form, it just
seems clunky.  I'd definitely use $_SESSION variables.

BUT.. If you absolutely had to pass this array via a HIDDEN form
element, I'd recommend trying serialize() and unserialize()

>From the PHP manual:
"serialize() returns a string containing a byte-stream representation of
value that can be stored anywhere. 

This is useful for storing or passing PHP values around without losing
their type and structure. 

To make the serialized string into a PHP value again, use unserialize().
serialize() handles all types, except the resource-type. You can even
serialize() arrays that contain references to itself. References inside
the array/object you are serialize()ing will also be stored."

I couldn't say it any better than that.

http://us2.php.net/manual/en/function.serialize.php

-TG

> -----Original Message-----
> From: Vail, Warren [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 7:13 PM
> To: 'MikeA'; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Re: Passing an Array in HTML
> 
> 
> Only real array I've ever seen in HTML is one passed to 
> JavaScript.  Anyone
> else found another way?
> 
> I suppose you could do it as a pull down list (preselecting 
> all selections),
> but risk is your user will screw up the data by clicking on 
> the list, but
> that struck me as kind of hokey (a technical term if the 
> highest order ;-).
> 
> Warren Vail
> 
> 
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > Sent: Monday, November 22, 2004 4:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Re: Passing an Array in HTML
> > 
> > 
> > So the only way to do it is by separating all of the elements 
> > instead of sending it as one big array?  Hmmm.  There is no 
> > better way to pass an array?
> > 
> > Thanks.
> > 
> > Mike
> > 
> > 
> > "Vail, Warren" <[EMAIL PROTECTED]> wrote in message 
> > news:[EMAIL PROTECTED]
> > ab.com...
> > > You can pass array data by adding it to the form (probably 
> > not a good 
> > > practice, I would choose sessions to pass the data, but 
> incase you 
> > > have
> > some
> > > need that is ok, try the following);
> > >
> > > // To add the data to your form;
> > >
> > > Foreach($data_old as $k => $v) echo "<input type=hidden 
> > > name=\"dataold[".$k."]\" value = \"".$v."\">\n";
> > >
> > > // to get the data returned from the form add the 
> following to the 
> > > module specified in the form action field
> > >
> > > $data_old = $_POST["dataold"];
> > >
> > > // $data_old now contains the array contents
> > >
> > > Haven't tried this but I suspect it should work; anyone 
> aware of a 
> > > limit
> > on
> > > the number of hidden elements in a form?
> > >
> > > Hope this helps,
> > >
> > > Warren Vail
> > >
> > >
> > > > -----Original Message-----
> > > > From: news [mailto:[EMAIL PROTECTED] On Behalf Of MikeA
> > > > Sent: Monday, November 22, 2004 3:50 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] Passing an Array in HTML
> > > >
> > > >
> > > > I am reading a file into an array ($data_old =
> > > > file("config.old");) and then processing it as I receive 
> > information 
> > > > from the user.  As we all know, the Internet is 
> > stateless, so I need 
> > > > to read back in the array after I get my answer.
> > > >
> > > > Array definitions are
> > > >
> > > > $data_old = array();
> > > > $data_new = array();
> > > > $data_count = 0;
> > > >
> > > > The output code is
> > > >
> > > > echo "<P><input type='hidden' name='data_old' 
> > > > value='".$data_old."'>"; echo "<P><input type='hidden' 
> > > > name='data_old' value='".$data_new."'>"; echo "<P><input 
> > > > type='hidden' name='data_count' value=".$data_count.">";
> > > >
> > > > and the input code is
> > > >
> > > > $data_old = $_REQUEST['data_old'];
> > > > $data_new = $_REQUEST['data_new'];
> > > > $data_count = $_REQUEST['data_count'];
> > > >
> > > > $data_count is working so I am assuming my problem is the 
> > way that I 
> > > > am passing the array.  How can I pass an array or is it not 
> > > > possible?  I would think that anything can be passed as 
> > it is just 
> > > > bits of data (pun intended). So what goes out should come 
> > in.  But, 
> > > > for some reason, that is not happening.
> > > >
> > > > Any help, suggestions, and guidance is appreciated.
> > > >
> > > > Mike

--- End Message ---
--- Begin Message ---
look at serialize

http://us2.php.net/manual/en/function.serialize.php

and in the user notes below, note that serialize doesn't remove quotes so need 
to base64_encode() after the serialize.

base64_encode(serialize($array)) 

than reverse on the other end

unserialize(base64_dencode($array)) 


> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] Behalf Of MikeA
> Sent: November 22, 2004 18:50
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Passing an Array in HTML
> 
> 
> I am reading a file into an array ($data_old = 
> file("config.old");) and then
> processing it as I receive information from the user.  As we 
> all know, the
> Internet is stateless, so I need to read back in the array 
> after I get my
> answer.
> 
> Array definitions are
> 
> $data_old = array();
> $data_new = array();
> $data_count = 0;
> 
> The output code is
> 
> echo "<P><input type='hidden' name='data_old' value='".$data_old."'>";
> echo "<P><input type='hidden' name='data_old' value='".$data_new."'>";
> echo "<P><input type='hidden' name='data_count' 
> value=".$data_count.">";
> 
> and the input code is
> 
> $data_old = $_REQUEST['data_old'];
> $data_new = $_REQUEST['data_new'];
> $data_count = $_REQUEST['data_count'];
> 
> $data_count is working so I am assuming my problem is the way 
> that I am
> passing the array.  How can I pass an array or is it not 
> possible?  I would
> think that anything can be passed as it is just bits of data 
> (pun intended).
> So what goes out should come in.  But, for some reason, that is not
> happening.
> 
> Any help, suggestions, and guidance is appreciated.
> 
> Mike
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
I'am using PHPNUKE for manage my site but I want to connect it to an LDAP.

I can't found Ldap LIBRARY for PHP on net (link isn't avalable).

where I can found a Alternative download for it ?

If you always have a PhP -> ldap configuration avalable explain me it
because, I'am lost ....

thanks

eric


»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
   Eric Ludinart
   Software Application Developper
   Production Control technician ATMEL Rousset
   [EMAIL PROTECTED]
   +33 442536921
   ATMEL FAB7 13106 Rousset
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»

--- End Message ---
--- Begin Message ---
Hello everyone.

I have downloaded and uninstalled then installed mysql v4.1.7
I have also downloaded & clean installed phpMyAdmin 2.6.0-pl3

Even though I can login from mysql administrator I can not login from
phpmyadmin.

Both mysql 4.1.7win, php 5.0.2 & apache2 have utf8, utf-8 as default
character sets.

I get the "Wrong username/password. Access denied." error. Ýt keeps asking
for my login name & passwd.

I have made the following changes to Config.inc.php for phpmyadmin.

$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin/';
$cfg['Servers'][$i]['host']          = 'localhost';
$cfg['Servers'][$i]['port']          = '';
$cfg['Servers'][$i]['auth_type']     = 'http';
$cfg['Servers'][$i]['user']          = 'root';
$cfg['Servers'][$i]['password']      = '';

I do get up to the login screen. But no further.

What am I missing? Any clues? Should I downgrade to php 4.3.9???

Note:
Php is fine since I can run the following code:
<?php echo date("h:i:s a", time()); ?> in a web page.

--- End Message ---

Reply via email to