php-general Digest 12 Feb 2004 06:20:40 -0000 Issue 2585

Topics (messages 177436 through 177477):

Re: [Q]PHP not taking input values from forms
        177436 by: Richard Davey
        177437 by: John Nichel
        177440 by: Dan Aloma
        177441 by: Richard Davey
        177442 by: Dan Aloma
        177443 by: Richard Davey
        177444 by: John Nichel
        177470 by: André Cerqueira

Re: question
        177438 by: John Nichel

Re: question {way OT}
        177439 by: Jay Blanchard

Re: Undefined function
        177445 by: Dominique ANOKRE

Help with ldap_add
        177446 by: Chakravarthy Cuddapah

date() funtion  language
        177447 by: Thiago Pavesi
        177448 by: Richard Davey
        177469 by: André Cerqueira

A dumb question
        177449 by: Jeremy Schroeder
        177450 by: Chris W. Parker
        177452 by: Chris W. Parker
        177471 by: Paul Furman

Re: parse error, unexpected $
        177451 by: Hugh Danaher

Re: Sessions on Win2k
        177453 by: memoimyself.yahoo.com.br

Re: array data
        177454 by: memoimyself.yahoo.com.br

Please help me understand gmmktime()
        177455 by: Richard Day

Re: Zlib - Insert files?
        177456 by: Markus Fischer

mutliple select form not passing multiple values
        177457 by: Ben Ramsey
        177459 by: Richard Davey
        177460 by: Ben Ramsey
        177463 by: Richard Davey

Re: [Q] Problems invoking a PHP script - Have no hair left to pull - Please help  [:-)
        177458 by: Richard Davey

Re: replace ' with "
        177461 by: Kim Steinhaug

Re: uploaded files are corrupted
        177462 by: Pablo Gosse

form array
        177464 by: Matthew Oatham
        177465 by: Martin Towell

I think this is a mysql question
        177466 by: Ronald Ramos
        177467 by: Justin Patrin
        177475 by: Ronald Ramos

PHP FILE SIZE LIMIT
        177468 by: Matthew Oatham
        177473 by: André Cerqueira

Re: Newbie questions
        177472 by: Jason Wong
        177474 by: John Nichel

my improved code:: array data
        177476 by: Imran Asghar

weird header() (bug may be)
        177477 by: adwinwijaya

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 ---
Hello Dan,

Wednesday, February 11, 2004, 6:01:21 PM, you wrote:

DA> Sorry about not including code the first time. Here is a snippet of code I
DA> am fairly certain should be doing something. Thank you SOOO much for the

Your code is (mostly) fine. The only part that didn't work is the final
"the form has been submitted" section because it comes after the HTML
page end. Move it to the start. Also, you don't have a closing form
tag.

The following is your code, changed slightly.. try it and see but it
works perfectly here (PHP 4.3.2, Apache, Windows). I added the echo
time() line so you can see if the page reloads or not:

<html>
<body>

<?php
if ($_POST['submit']) {
        echo "The form has been submitted<br>";
        echo time();
}
?>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="500" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>Your name:</td>
<td><input type="text" name="name"value="<?=$_POST['name']?>"></td>
</tr>
<tr>
<td>Your email:</td>
<td><input type="text" name="email" value="<?=$_POST['email']?>"><td>
<tr>
<tr>
<td>Your message:</td>
<td><textarea name="message"><?=$_POST['message']?></textarea></td></tr>
</table>
<input type="hidden" name="required" value="name,email,message">
<input type=submit name="submit" value="submit">
</form>

</body>
</html>

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Dan Aloma wrote:

Sorry about not including code the first time. Here is a snippet of code I am fairly certain should be doing something. Thank you SOOO much for the help. I've been working on setting up php for four days now and EVERYTHING else works (phpinfo() calls, etc), but for some reason forms, even ones that I know should be working don't take values. They just return you to the same screen.

CODE:
<html>
<body>

<br><br>
<?=$errormessage?>
<br>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="500" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>Your name:</td>
<td><input type="text" name="name"value="<?=$_POST['name']?>"></td>
</tr>
<tr>
<td>Your email:</td>
<td><input type="text" name="email" value="<?=$_POST['email']?>"><td>
<tr>
<tr>
<td>Your message:</td>
<td><textarea name="message"><?=$_POST['message']?></textarea></td></tr>
</table>
<input type="hidden" name="required" value="name,email,message">
<input type="submit" name="submit" value="submit">

</body></html>

<?php
if ($_POST['submit']) {
  print "the form has been submitted";
}
?>

What's the output to the browser when you submit this?


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

--- End Message ---
--- Begin Message --- I tried adding that code you gave me, but all it does go back to the same page, and doesn't echo out the time(); results. I can't seem to figure it out for the life of me. like i said, everything else in php is working fine, except for this.


From: Richard Davey <[EMAIL PROTECTED]>
Reply-To: Richard Davey <[EMAIL PROTECTED]>
To: "Dan Aloma" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re[2]: [PHP] [Q]PHP not taking input values from forms
Date: Wed, 11 Feb 2004 18:20:11 +0000

Hello Dan,

Wednesday, February 11, 2004, 6:01:21 PM, you wrote:

DA> Sorry about not including code the first time. Here is a snippet of code I
DA> am fairly certain should be doing something. Thank you SOOO much for the


Your code is (mostly) fine. The only part that didn't work is the final
"the form has been submitted" section because it comes after the HTML
page end. Move it to the start. Also, you don't have a closing form
tag.

The following is your code, changed slightly.. try it and see but it
works perfectly here (PHP 4.3.2, Apache, Windows). I added the echo
time() line so you can see if the page reloads or not:

<html>
<body>

<?php
if ($_POST['submit']) {
        echo "The form has been submitted<br>";
        echo time();
}
?>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="500" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>Your name:</td>
<td><input type="text" name="name"value="<?=$_POST['name']?>"></td>
</tr>
<tr>
<td>Your email:</td>
<td><input type="text" name="email" value="<?=$_POST['email']?>"><td>
<tr>
<tr>
<td>Your message:</td>
<td><textarea name="message"><?=$_POST['message']?></textarea></td></tr>
</table>
<input type="hidden" name="required" value="name,email,message">
<input type=submit name="submit" value="submit">
</form>

</body>
</html>

--
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

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


_________________________________________________________________
Click here for a FREE online computer virus scan from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--- End Message ---
--- Begin Message ---
Hello Dan,

Wednesday, February 11, 2004, 6:32:16 PM, you wrote:

DA> I tried adding that code you gave me, but all it does go back to the same
DA> page, and doesn't echo out the time(); results. I can't seem to figure it
DA> out for the life of me. like i said, everything else in php is working fine,
DA> except for this.

If it doesn't even echo out time() then you have something very wrong
in either the installation of PHP (unlikely) or the configuration of
using PHP on your web server. Where are these files being
hosted/tested?

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- they're being tested on a testing machine we use. I know PHP is (rather appears to be) working fine. Why would it be parsing files fine and calling phpinfo() fine, but not being able to take input values. that's strange....


From: Richard Davey <[EMAIL PROTECTED]>
Reply-To: Richard Davey <[EMAIL PROTECTED]>
To: "Dan Aloma" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re[4]: [PHP] [Q]PHP not taking input values from forms
Date: Wed, 11 Feb 2004 18:35:31 +0000

Hello Dan,

Wednesday, February 11, 2004, 6:32:16 PM, you wrote:

DA> I tried adding that code you gave me, but all it does go back to the same
DA> page, and doesn't echo out the time(); results. I can't seem to figure it
DA> out for the life of me. like i said, everything else in php is working fine,
DA> except for this.


If it doesn't even echo out time() then you have something very wrong
in either the installation of PHP (unlikely) or the configuration of
using PHP on your web server. Where are these files being
hosted/tested?

--
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]



_________________________________________________________________
Choose now from 4 levels of MSN Hotmail Extra Storage - no more account overload! http://click.atdmt.com/AVE/go/onm00200362ave/direct/01/

--- End Message ---
--- Begin Message ---
Hello Dan,

Wednesday, February 11, 2004, 6:39:35 PM, you wrote:

DA> they're being tested on a testing machine we use. I know PHP is (rather
DA> appears to be) working fine. Why would it be parsing files fine and calling
DA> phpinfo() fine, but not being able to take input values. that's strange....

echo time() isn't an input value.

If it can't even do that then it's not surprising it can't handle
$_POST values either, there is something else at play here and it's
not your code.

Stick "echo phpinfo()" at the top of your form code - does it work?

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Dan Aloma wrote:

I tried adding that code you gave me, but all it does go back to the same page, and doesn't echo out the time(); results. I can't seem to figure it out for the life of me. like i said, everything else in php is working fine, except for this.

Fill in some values for your form fields, submit it, and post the source (HTML) of the page it returns.


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

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

time() is only echo'ed if $_POST['submit'] is something on this case
maybe he has a really old version of php...
$HTP_POST_VARS...?

do what Richard Davey is saying, <?=phpinfo()?> on the top

Richard Davey wrote:

Hello Dan,

Wednesday, February 11, 2004, 6:39:35 PM, you wrote:

DA> they're being tested on a testing machine we use. I know PHP is (rather
DA> appears to be) working fine. Why would it be parsing files fine and calling
DA> phpinfo() fine, but not being able to take input values. that's strange....

echo time() isn't an input value.

If it can't even do that then it's not surprising it can't handle
$_POST values either, there is something else at play here and it's
not your code.

Stick "echo phpinfo()" at the top of your form code - does it work?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAKutoaxdA/5C8vH8RAo1WAJ9MZMtBAvXcJDizOVXblxp1DlCqSgCeNDdm
rmE+jBIlMe4Hb6qaIUObCiQ=
=NvxC
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message --- Chris W. Parker wrote:

Meramec Challenge Paintball, LLC <mailto:[EMAIL PROTECTED]>
    on Wednesday, February 11, 2004 7:40 AM said:

I'm glad you put "question" in your subject line because for a minute
there I thought you were sending me a note of praise. I realized you
weren't once I read your informative subject line.


I have tried for a long time now on various forums to get help. Every
one says to come to you for support. I looked for a forum on your
site but did not see one.


On my site??

;)


I had to turn the Enable account activation by admin feature. In
doing so when someone tries to create an account when they hit submit
they get this error:


You assume anyone here knows what you're talking about. What program is
this that you're using?


Line : 234

File : /home/mcpain36/public_html/forum/includes/emailer.php[/code]


What exactly is the error?


It does not send them an email about how the admin has to turn on the
account. How can I fix this?


By answering the above two questions and showing us what is on line 234
of /home/mcpain36/public_html/forum/includes/emailer.php. That will at
least give us a starting point.


Chris.



Did you forget your mind-reading helmet at home today?


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

--- End Message ---
--- Begin Message ---
[snip]
Did you forget your mind-reading helmet at home today?
[/snip]

I have both kinds of ESP.....ESPn & ESPn2 :)

--- End Message ---
--- Begin Message ---
Ok, everything run now !
the problem was the path to the database.
You must indicate like this :

$host = localhost:c:\path\to\databasename

Thanks you !!
----- Original Message -----
From: "John Nichel" <[EMAIL PROTECTED]>
To: "Dominique ANOKRE" <[EMAIL PROTECTED]>
Cc: "Php List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 11, 2004 3:16 PM
Subject: Re: [PHP] Undefined function


> Dominique ANOKRE wrote:
>
> > ok ,
> >
> > i install the good php windows installer (with interbase) and now i
think my
> > function is recognized.
> > But the message displayed is :
> >
> > Warning: ibase_connect(): unavailable database in
> > c:\inetpub\wwwroot\index.php on line 12
> >
> > But i can connect to the database whitout any problems via interbase
console
> > .....
> >
> > So what'is wrong ??????
>
> Without seeing the code, I can only guess that the problem is either a)
> your code, b) database configuration, c) network connectivity, d) etc,
> or e) between the monitor and chair. ;)
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message --- I am using RedHat Enterprise Linux (ES). Installed openldap, php, apache latest versions. All except ldap_add functions are working. When I use ldapadd at the terminal it works adding entries to ldap. But when I use php ldap_add , error code shows it is Success. But does not add any entires to ldap. I am using the form uid-xxx, cn=xxx,ou=xxx,o=xxxxx. It works for cn=xxx,ou=xxx,o=xxx. When I try to add uid=xxx, cn=xxx,ou=xxx,o=xxxxx it fails. slapd log shows err=0. Appreciate any help.

_________________________________________________________________
Keep up with high-tech trends here at "Hook'd on Technology." http://special.msn.com/msnbc/hookedontech.armx

--- End Message ---
--- Begin Message --- Hello,

Does any one knows how do I set my date() function to return the days of the week and moth in my own language (brazilian portuguese)?

Thanks,

Thiago Pavesi
--- End Message ---
--- Begin Message ---
Hello Thiago,

Wednesday, February 11, 2004, 8:03:47 PM, you wrote:

TP>   Does any one knows how do I set my date() function to return the days
TP> of the week and moth in my own language (brazilian portuguese)?

setlocale()

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

i had problems with locale
i think its safer to make a dayname and monthname array, and use
getdate(), than build the string yourself

like:


<? $wdayname_array = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'); $monthname_array = array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');

function date_wrapper($format, $timestamp=NULL)
{
        global $wdayname_array, $monthname_array;

        if ($timestamp == NULL)
                $timestamp = time();

        $date = getdate($timestamp);
        $wdayname = $wdayname_array[$date['wday']];
        $monthname = $monthname_array[$date['mon']-1];

        $format = str_replace(array('l', 'F'), array('\\\\\l', '\\\\\F'), $format);
        $date = date($format, $timestamp);
        $date = str_replace(array('\\l', '\\F'), array($wdayname, $monthname),
$date);

        return $date;
}

echo date_wrapper('l, d \de F \de Y');

//the follow should, but doesnt seem to work
//setlocale(LC_ALL, 'pt_BR');
//echo date('l, j de F de Y');
?>


this example may not work well with slashes... just wrote it hehe



tb sou brasileiro hehe (im brazillian too)



Thiago Pavesi wrote:


| Hello,
|
| Does any one knows how do I set my date() function to return the days
|  of the week and moth in my own language (brazilian portuguese)?
|
| Thanks,
|
| Thiago Pavesi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAKuWmaxdA/5C8vH8RAv7gAJ0WHvXC4beywQDTjQzz7KI0jLGfPACgjqgv
y/UzSg9ijyRx/UvWGi8dFXU=
=Wh2S
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message --- Hey Group

I am starting to write class and objects and came across some syntax that I dont understand.

What does the ampersand do in the bottom example code, they both work.

$n1 = $num1 -> function();
$n1 = & $num1 -> function();

-Blake
--- End Message ---
--- Begin Message ---
Jeremy Schroeder <mailto:[EMAIL PROTECTED]>
    on Wednesday, February 11, 2004 11:39 AM said:

> What does the ampersand do in the bottom example code, they both work.
> 
> $n1 = $num1 -> function();
> $n1 = & $num1 -> function();

I think in this it's what's called a reference. Don't know much else. :)



Chris.

--- End Message ---
--- Begin Message ---
Chris W. Parker <>
    on Wednesday, February 11, 2004 11:45 AM said:

> I think in this it's what's called a reference. Don't know much else.
> :) 

Ok that should be "I think this is what's called"... had to correct
that.

--- End Message ---
--- Begin Message --- Chris W. Parker wrote:
Chris W. Parker <>
    on Wednesday, February 11, 2004 11:45 AM said:


I think in this is what's called a reference.


Sounds like that's simply a way of making an alias for a variable:
http://us2.php.net/manual/en/language.references.php

--- End Message ---
--- Begin Message ---
Bruno,
This often occurs when there is no closing bracket " } " for a conditional
statement or a loop.
hth
Hugh
----- Original Message -----
From: "Bruno Mattarollo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 11, 2004 2:51 AM
Subject: Re: [PHP] parse error, unexpected $

> Parse error: parse error, unexpected $ in
> /var/www/html/donation/installations/gpi/form.inc on line 528

--- End Message ---
--- Begin Message ---
Hello Don,

On 11 Feb 2004 at 11:19, Donpro wrote:

> I've searched the archives and note that many have probelms using session on
> a Win2K server.  I am getting a
>  
> Undefined index: sessions in
> D:\inetpub\mydomain\www\forms\formmail\formmail.php on line 768
>  
> error.  Line 768 is: session_start();
>  
> It works Ok on Linux; is there any "special" Windows configuration?

Are you perchance running your script on a machine with an active firewall? I had all 
sorts of session-related problems and spent ages trying to figure out what was wrong 
with my code until eventually I read somewhere that ZoneAlarm might interfere with 
sessions. I shut down ZA and — guess what? — there wasn't anything wrong with my 
code after all. Now whenever I need to test scripts involving sessions I disconnect 
from 
the Internet and shut down ZoneAlarm.

Hope this helps,

Erik

--- End Message ---
--- Begin Message ---
Hello Imran,

On 12 Feb 2004 at 1:17, Imran Asghar wrote:

> Hi,
>  
> Is not working, is it correct way????
> 
> File1.php
>        <? $colors = array('red','blue','green','yellow'); ?>
>        <form action="file2.php" method="post">
>       <input type="hidden" type" name="colors" value="<?=$colors?>">
>       </fomr> 
> 
> File2.php
>  
> <? 
>  echo $colors[0];
>  echo $colors[1];
>  echo $colors[2];
>  echo $colors[4];
> ?>
> 
> 
> 
> imee
> 

I'm afraid you'll have to start learning PHP from scratch. The freely-available PHP 
manual has a fairly good introductory section and you'll also find tons of tutorials 
for 
beginners on the web.

Good luck,

Erik

--- End Message ---
--- Begin Message ---
Hello:


Environment:
    Linux server
    PHP 4.3.4

This code:

    echo '<br>'.strftime('%T %Z',mktime()).', Timestamp='.mktime();
    echo '<br>'.strftime('%T GMT',gmmktime()).', Timestamp='.gmmktime();

yields this result:

    23:52:08 EST, Timestamp=1076475128
    18:52:08 GMT, Timestamp=1076457128

Why? GMT should be 5 hours ahead of EST, not 5 behind. Right? What am I
missing here??


Richard

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

basically, gzip is only about compression of data. If you want compress more than one file at once, you need to put it into an archive before, e.g. a tar archive. Then you can compress this tar-Archive (single file) width gzip.

HTH,
- Markus

--- End Message ---
--- Begin Message --- I'm running PHP 5.0b3, so I'm not sure whether this is an issue with the version of PHP I'm running.

I've got a select field in a form that is allowing multiple selects:

<select name="modules" size="10" multiple="multiple" id="modules" style="height: 150px;">
<option value="2" selected="selected">Banner Manager</option>
<option value="3" selected="selected">Calendar of Events</option>
<option value="4">Contacts</option>
<option value="5">Elections</option>
<option value="6" selected="selected">Emergency Notices</option>
<option value="11" selected="selected">Employment Opportunites</option>
<option value="7" selected="selected">FAQs</option>
<option value="8" selected="selected">Files & Downloads</option>
<option value="9">Image Gallery</option>
<option value="12">Links</option>
<option value="13" selected="selected">Meetings & Agendas</option>
<option value="1" selected="selected">News & Articles</option>
<option value="16" selected="selected">Notices of Public Hearing</option>
<option value="14" selected="selected">Procurement Opportunities</option>
<option value="15" selected="selected">Publications</option>
<option value="18">Weather Information</option>
</select>


I'm posting the data to another script, in which I have the following:

print_r($_POST);

The only thing that is being saved to $_POST['modules'] is the last value (15). When I count($_POST['modules']), I only get 1, so I know that it's not passing back an array of numbers like it should.

Am I doing something wrong?

-Ben
--- End Message ---
--- Begin Message ---
Hello Ben,

Wednesday, February 11, 2004, 9:22:33 PM, you wrote:

BR> Am I doing something wrong?

Yup :)

It needs to be:

<select name="modules[]" ...

Note the change in name from modules to modules[]

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Ah-ha! I missed that, and I always do. Let's hope I don't anymore. While we're on the subject, why is PHP set up this way? Why can't it just add the elements to the array automatically, since adding the square brackets to one's HTML form name is not a standard practice?


Richard Davey wrote:
Hello Ben,

Wednesday, February 11, 2004, 9:22:33 PM, you wrote:

BR> Am I doing something wrong?

Yup :)

It needs to be:

<select name="modules[]" ...

Note the change in name from modules to modules[]


--- End Message ---
--- Begin Message ---
Hello Ben,

Wednesday, February 11, 2004, 9:38:38 PM, you wrote:

BR> Ah-ha!  I missed that, and I always do.  Let's hope I don't anymore.
BR> While we're on the subject, why is PHP set up this way?  Why can't it
BR> just add the elements to the array automatically, since adding the
BR> square brackets to one's HTML form name is not a standard practice?

I guess because the times when a value will be an array vs. a straight
variable are probably so small that it's un-necessary overhead on
PHP's behalf to have to treat every single element as a potential
array. Far easier to just stick [] on the end and tell PHP it is.

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hello Tony,

Wednesday, February 11, 2004, 9:16:18 PM, you wrote:

TDS> That was the problem.  The PHP book I have doesn't mention $_GET or $_POST.
TDS> The exercises right from the beginning use register_globals. I didn't
TDS> realise they were turned off by default.

Whoever wrote that book ought to be shot :)
(metaphorically speaking)

Unless it's a quite old book?

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Depending on the use you might also want to look at this one :
htmlentities()

If working with mySQL inserts consider this aswell :
mysql_escape_string()

And finally, javascripts in HTML doesnt like either the ' " or the
equivilant htmlentities. I just wash them away direkt if i need to
output something into a javascript statement, eg.
   <a href="javascript: dome('typicaltext');">

The above example caused me alot of headaches when the text inside '
contained either ' or ", and even the entities also messed up.

-- 
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------

"Diana Castillo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How do I replace all single quotes with double quotes in a string for
> echoing it with the double quotes?
>
> --
> Diana Castillo
> Global Reservas, S.L.
> C/Granvia 22 dcdo 4-dcha
> 28013 Madrid-Spain
> Tel : 00-34-913604039 ext 214
> Fax : 00-34-915228673
> email: [EMAIL PROTECTED]
> Web : http://www.hotelkey.com
>       http://www.destinia.com

--- End Message ---
--- Begin Message ---
<snip>
> I have a script that allows the user to browse his/her local hard
drive
for
> a file and email it as an attachment.  Text files come through OK but
any
> binary type file, e.g., JPEG or PDF arrive broken.  JPEG will show as
a
red
> X in my browser and Adobe will complain about the PDF.  I don't know
why???
</snip>

I recently encountered this issue and as far as I can tell it has
nothing to do with PHP.  In my case it was caused by some arcane problem
which occurred when installing the os and software (Apache, PHP,
PostgreSQL, etc.) straight from a RedHat cd instead of downloading and
compiling the source files.

Everything worked fine except POST method uploads.  Whenever I attempted
to upload a file it would not upload properly, and if I was using a
textarea to post a large chunk of code to a page for processing the code
would also get mangled somewhere after clicking the submit button and
before it was accessible via the $_POST array in the receiving script.

The only thing I was able to surmise was that the problem had something
to do with the "vanilla install" (as my sysadmin described it) of
Apache, PHP and PostgreSQL.  When I moved the project I was working on
to its permanent home (an actual Dell server with everything compiled
properly from the source) the problem disappeared altogether.

I also tested it on a number of other production machines here and it
worked fine on all of them.

If possible I would suggest you take your code to another machine and
test it out there as I would wager that the problem is within your
system, not your code or PHP settings.

I know this isn't an answer per se but I hope that is of some use and
will save wasted time in trying to figure out the problem.

Cheers,
Pablo.

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

I have a form on page1 that i want to submit to another php page - page2

the form has the fields

<input type="hidden" name="image[one]" value="one">
<input type="hidden" name="image[two]" value="two">
<input type="hidden" name="image[three]" value="three">

Basically I want to have these form field values as an array of values I can
loop through on page 2 but what do I put on page 2 too get the array and
loop through ?

Thanks.

--- End Message ---
--- Begin Message ---
Matthew,

use $_POST/$_GET/$_REQUEST (depending on your form method)  and  foreach()

eg:
  foreach($_POST['image'] as $key=>$value)
  {
    echo "$key -> $value<br>\n";
  }

Martin


> -----Original Message-----
> From: Matthew Oatham [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 12 February 2004 11:29 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] form array
> 
> 
> Hi,
> 
> I have a form on page1 that i want to submit to another php 
> page - page2
> 
> the form has the fields
> 
> <input type="hidden" name="image[one]" value="one">
> <input type="hidden" name="image[two]" value="two">
> <input type="hidden" name="image[three]" value="three">
> 
> Basically I want to have these form field values as an array 
> of values I can
> loop through on page 2 but what do I put on page 2 too get 
> the array and
> loop through ?
> 
> Thanks.

--- End Message ---
--- Begin Message ---
How can I use PHP to compute the difference between two dates(with
time)?
Let's say in mysql, I have field 1, login, and on field 2, I have
logout.

How can I compute the diffrence between login and logut and output it on
field 3 let's say totaltime.

Is this a mysql question? Or can PHP actually do this?

TIA

--- End Message ---
--- Begin Message --- Ronald Ramos wrote:

How can I use PHP to compute the difference between two dates(with
time)?
Let's say in mysql, I have field 1, login, and on field 2, I have
logout.

How can I compute the diffrence between login and logut and output it on
field 3 let's say totaltime.

Is this a mysql question? Or can PHP actually do this?

TIA

Both can do it, but it depends heavily on what type of date format it is. If it's a normal mysql date or datetime (not a timestamp) then you can grab it, then do:


$seconds = strtotime($field1) - strtotime($field2);

strtotime() does a good job of converting just about every type of formatted date.

If you're using a timestamp, there aren't any deliminators. I'm not sure if strtotime() will parse those as you want. In this case (and the other, actually) you can easily use SQL.

SELECT UNIX_TIMESTAMP(field1) - UNIX_TIMESTAMP(field2) AS secondsBetween FROM table

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
create table oras(
Name    VARCHAR(30),
TimeIn DATETIME,
TimeOut DATETIME,
Total   DATETIME
);

insert into oras values('Nhadie','2004-10-10 10:10:00','2004-11-11
12:12:00','TIMEDIFF(TimeIn,TImeOut)');

Hi,

Are those correct? Because the value on the Total field is 000-00-00
00:00:00.
I think there's something wrong. I'm using 4.0.


mysql> select * from oras;
+--------+---------------------+---------------------+------------------
---+
| Name   | TimeIn              | TimeOut             | Total
|
+--------+---------------------+---------------------+------------------
---+
| Nhadie | 2004-10-10 10:10:00 | 2004-11-11 12:12:00 | 0000-00-00
00:00:00 |
+--------+---------------------+---------------------+------------------
---+
1 row in set (0.01 sec)

TIA












-----Original Message-----
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 9:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: I think this is a mysql question


Ronald Ramos wrote:

> How can I use PHP to compute the difference between two dates(with 
> time)? Let's say in mysql, I have field 1, login, and on field 2, I 
> have logout.
> 
> How can I compute the diffrence between login and logut and output it 
> on field 3 let's say totaltime.
> 
> Is this a mysql question? Or can PHP actually do this?
> 
> TIA

Both can do it, but it depends heavily on what type of date format it 
is. If it's a normal mysql date or datetime (not a timestamp) then you 
can grab it, then do:

$seconds = strtotime($field1) - strtotime($field2);

strtotime() does a good job of converting just about every type of 
formatted date.

If you're using a timestamp, there aren't any deliminators. I'm not sure

if strtotime() will parse those as you want. In this case (and the 
other, actually) you can easily use SQL.

SELECT UNIX_TIMESTAMP(field1) - UNIX_TIMESTAMP(field2) AS secondsBetween

FROM table

--
paperCrane <Justin Patrin>

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

--- End Message ---
--- Begin Message ---
hi is there a limit to the filesize of a php ? 

I know tomcat had limits on the file size of jsps.

My problem is I have a 13kb php file when I add some more lines of code to it the html 
output becomes currupt - it could well be bad html but I cant find it so thought I 
would ask this question?

Cheers.

Matt

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

everything has a limit, but im sure in this case you are under it big time
ive seen ppl running 1-2megs scripts hehe




Matthew Oatham wrote:


hi is there a limit to the filesize of a php ?

I know tomcat had limits on the file size of jsps.

My problem is I have a 13kb php file when I add some more lines of code to it the html output becomes currupt - it could well be bad html but I cant find it so thought I would ask this question?

Cheers.

Matt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAKwM1axdA/5C8vH8RAoz/AJ9KludBI0UZp5XPq7mqOlYAdaDsZwCfTJKn
aYSg7klSbEigX4QEYq/md6M=
=DZ+C
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
On Thursday 12 February 2004 01:03, James Marcinek wrote:

> I have a couple of questions I'd like to ask:
>
> 1.) Are there built in libraries to connect to DB2?
> Nothings clear from the documentation I've read. I see
> that there's libraries for Oracle, Informix, MySQL.

Apparently so, ask google.

> 2.) If there is a DB2 library(support or whatever its
> called, someone enlighten me please with the correct
> term!) does anyone know if the Red Hat rpm comes with
> the option to support this turned on?

Ask RedHat?

> 3.) I'm just coming across some information about
> PEAR. My question to this: Is it better to use PEAR
> than the regular libraries included?

What exactly do you mean by "the regular libraries included"? Basically using 
the PEAR libraries will save you from re-inventing many wheels, the downside 
being the extra overhead required. www.phpclasses.org is also a great source 
of classes/libraries.

> Anything else anyone could tell me would be great!

Depends on what you want to know. Almost every problem that you will come 
across will be covered in:

 - the php manual
 - the list archives
 - google

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
All diplomacy is a continuation of war by other means.
                -- Chou En Lai
*/

--- End Message ---
--- Begin Message ---
Jason Wong wrote:
<snip>
Anything else anyone could tell me would be great!


Depends on what you want to know. Almost every problem that you will come across will be covered in:

 - the php manual
 - the list archives
 - google


Don't forget about Mr. Holmes. I betcha he's got php scribbled all over the walls of his house...so the OP could check there. ;)


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

--- End Message ---
--- Begin Message ---
Thnx everyone,

My improved code, which is working fine 


File1.php
        <? 
                $colors = array('red','blue','green','yellow'); 
                $serial_colors = serialize($colors);
                $serial_colors= rawurlencode($serial_colors);
        ?>
        <form action="file2.php" method="post">
       <input type="hidden" type" name="serial_colors" value="<?=$serial_colors?>">
       </fomr> 
 
File2.php
  
<? 
    
  $Outserial_colors= unserialize(rawurldecode($serial_colors));
  echo  $Outserial_colors[0];
  echo  $Outserial_colors[1];
  echo  $Outserial_colors[2];
  echo  $Outserial_colors[4];

 ?>


Best regards

imee
MSN: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hello php-generaler's ,

  I have a script like this :

  if($foo == 'something'){
          header('Location:to_another_page.php') ;
  }else
  {
       do another thing in here
  }

  header('Location:to_previous_page.php');


  I got a problem ... when $foo == 'something' .. it wont redirect me
  to to_another_page.php .... but if I put die(); after calling
  header(); .. it will work ...

  is this the bug ?

  I use php 4.3.4 ... and Apache 2.x

  thanks
  

-- 
Best regards,
 adwinwijaya                          mailto:[EMAIL PROTECTED]

--- End Message ---

Reply via email to