php-general Digest 14 Dec 2005 10:15:36 -0000 Issue 3849

Topics (messages 227398 through 227407):

Re: IE6 not returning POST data from a textarea
        227398 by: Curt Zirzow

Declaring arrays? Good practice?
        227399 by: Michael Hulse
        227400 by: Robert Cummings
        227401 by: Curt Zirzow
        227405 by: Michael Hulse

Message Should be displayed based on Date ,Time and Event name
        227402 by: suma parakala

EXPORT DATA
        227403 by: Aftab Alam
        227404 by: Zareef Ahmed

Can Anybody telll me more php search engine?
        227406 by: ynzheng.gmail (sent by Nabble.com)

Problem: Distortion while saving text file.
        227407 by: Janne Miettunen

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 ---
On Mon, Dec 12, 2005 at 08:33:40PM -0500, Al wrote:
> Al wrote:
> >Anyone know to get IE6 to return POST data from a textarea when the text 
> >is pasted in?
> >
> >Works fine for Mozilla, etc.
> >
> >print_r($_POST) shows several <input...> and <text  ...> values just fine.
> >
> >Thanks....
> 
> 
> For those interested, here is the answer...
> 
> Text pasted into a textarea [e.g., from Word] can have characters not 
> defined in IE's textarea ISO-8859-1 charset.
> 
> Appearently, IE6 has a bug such that it does not send the POST value for 
> the textarea name when some of these are present.  [e.g., "�" char [hex 
> 85]] I don't know how many.
> 
> You can get it to work by right-mouse selecting Encoding UTF-8 on the 
> client browser or use in the html header:
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

This is a good point. I would even go further and to have all php
files output in charset utf-8 by setting the ini setting:

  default_charset=UTF-8

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
Sorry if this question sounds noobish:

$foo = array(); // Declare first, good practice.
$foo = array('one', 'two', 'three');

Using above as example, is it good to always declare the array first?

I usually/always declare my arrays first, but sometimes I get a bit confused... for example:

function give_foo() {
        $the_foo = array(); // Declare first, good practice.
        $the_foo = array('one', 'two', 'three');
        // Do some stuff here...
        return $the_foo;
}
$foo = give_foo(); // Declare $foo also?

So, should I declare $foo as array and then give it the value of the function? Example:

$foo = array(); // Declare first, good practice.
$foo = give_foo();

That seems kinda redundant. Thoughts?

Sorry if this is a stupid question... I am self-taught, and I am trying to shake all my bad coding habits.
--- End Message ---
--- Begin Message ---
On Tue, 2005-12-13 at 22:34, Michael Hulse wrote:
> Sorry if this question sounds noobish:
> 
> $foo = array(); // Declare first, good practice.

The above is a declaration.

> $foo = array('one', 'two', 'three');

The above is ALSO a declaration.

The first declaration is redundant and unnecessary and suggests you
don't fully grasp declarations :)

> Using above as example, is it good to always declare the array first?
> 
> I usually/always declare my arrays first, but sometimes I get a bit 
> confused... for example:
> 
> function give_foo() {
>       $the_foo = array(); // Declare first, good practice.
>       $the_foo = array('one', 'two', 'three');
>       // Do some stuff here...
>       return $the_foo;
> }
> $foo = give_foo(); // Declare $foo also?
> 
> So, should I declare $foo as array and then give it the value of the 
> function? Example:
> 
> $foo = array(); // Declare first, good practice.

Again a nice declaration above :)

> $foo = give_foo();

Explicit assignment thus making the prior declaration redundant;
however, if you are the kind of person who generally declares all of
your variables at the top of a function, and the assignment to the
return value of give_foo() occurs later in the code, then I would say it
is good practice. But if you do the declaration immediately before in
arbitrary places in the code, then I'd say poor practice since nothing
is gained by the forward declaration.

> That seems kinda redundant. Thoughts?
> 
> Sorry if this is a stupid question... I am self-taught, and I am trying 
> to shake all my bad coding habits.

No need to apologize. Sounds like you're learning to fish.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Tue, Dec 13, 2005 at 07:34:31PM -0800, Michael Hulse wrote:
> Sorry if this question sounds noobish:
> 
> $foo = array(); // Declare first, good practice.
> $foo = array('one', 'two', 'three');
> 
> Using above as example, is it good to always declare the array first?

Well there really isn't any "declaration" in php, it is how you
initialize the variable.  By just doing a:

  $foo = array('one', 'two', 'three');

It is an explicit intialization and we know that anytime in later
code this thing is going to be an array and returned as an array.
The need to define the var as an empty array first is just extra
unneeded work

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
Thanks Curt and Robert! You guys really helped clear things up for me.

You guys rock!

I really appreciate all of your help.  :)
Cheers,
Micky

--- End Message ---
--- Begin Message ---
Hi
I am accepting event name,Date and time and saving the data in PostgeSQL table.. I have used PHP html Javascript and postgesql for this. Can anyone tell me how can I display a popup message when that particular event occurs on particular date and time.
Thanks
Suma

_________________________________________________________________
One and only Ash. Find out all about her. Only on MSN Search http://server1.msn.co.in/profile/aishwarya.asp
--- End Message ---
--- Begin Message ---
Hi all,

How can i export excel data to PostgresSQL using PHP.

regards
aftab

--- End Message ---
--- Begin Message ---
----- Original Message ----- 
From: "Aftab Alam" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, December 13, 2005 11:20 PM
Subject: [PHP] EXPORT DATA


> Hi all,
> 
> How can i export excel data to PostgresSQL using PHP.
> 
http//ww.phpclasses.org is good place to search. you can go there.

Zareef Ahmed
> regards
> aftab
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

====================================================
PHP Expert Consultancy in Development  http://www.indiaphp.com
Yahoo! : consultant_php MSN : [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
which search engine is dhoondho.com and beeblex.com  based on ?

any ralation links of dataparksearch engine and mnoGoSearch?


--
Sent from the PHP - General forum at Nabble.com:
http://www.nabble.com/Can-Anybody-telll-me-more-php-search-engine--t739540.html#a1935937

--- End Message ---
--- Begin Message ---
What could be wrong when this is transformed:
"<img src="graphics/auringonlasku2.jpg" align="left">"
....to this form:
"<img src=\"graphics/auringonlasku2.jpg\" align=\"left\">"

The line is saved to text file with this function:

function savesite($site, $lang, $contents){

if (check_session()){
$file=fopen('content/' . $site . '_' . $lang . '.txt', "w");

fwrite($file, $contents);

fclose($file);
}

I run it through nl2br() before saving and this only happens on Linux server, on Windows server it works fine, no \ before ".

Tested with:
On Windows: Apache2, PHP5
Linux: Debian distro, Apache2, PHP4, also tried with PHP5

--- End Message ---

Reply via email to