php-general Digest 14 Nov 2007 07:43:19 -0000 Issue 5127
Topics (messages 264446 through 264474):
Re: Problem retrieving $_POST values
264446 by: Jon Westcot
Re: Need a hint how to track an error
264447 by: Jochem Maas
264449 by: Jochem Maas
Re: Simple reading a file and extract fields
264448 by: Jochem Maas
Re: PHP 5.2.3 segfault with syslog standard extension
264450 by: Jochem Maas
PHP advice: Tips webpage valid?
264451 by: Dotan Cohen
264452 by: Robert Cummings
264453 by: mike
264462 by: Larry Garfield
264474 by: Dotan Cohen
Still searching for PHP Experts in SF, CA
264454 by: Cox, Chris
264455 by: Cox, Chris
Re: PHP ide?
264456 by: Chris
Quick questions -- how do I place the cursor (i.e., set focus) to a field on
page load?
264457 by: Jon Westcot
264458 by: mike
264459 by: Jon Westcot
264460 by: mike
264461 by: tedd
264463 by: Chris
264464 by: mike
264466 by: Jon Westcot
264467 by: Jon Westcot
264468 by: tedd
264469 by: mike
264470 by: tedd
264472 by: Casey
Input field
264465 by: Ronald Wiplinger
264471 by: Shelley Shyan
264473 by: Chris
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 ---
Hi Chris, et al.:
> > Here's a section of what comes back when I do this:
> >
> > [mls] => 1234567
> > [property_address] => Main St
> > [city_arr] => Array
> > (
> > [0] => CHNDHT
> > [1] => CHNDLR
> > [2] => GILBER
> > [3] => HIGLEY
> > [4] => MESA
> > [5] => TEMPE
> > )
>
> So it is there :)
>
> print_r($_POST['city_arr']);
After much wringing of hands and gnashing of teeth, I found the problem.
Typo. Of course. I'd only read over the code about a hundred times before
I asked for help, if that's any consolation.
> > > > Is there some (free <g>) way to test a php script outside of a web
page?
> > >
> > > cmd line you can do:
> > >
> > > php -l /path/to/file.php
> >
> > Is this something I can access through SSH? And will it show me
errors as the script executes?
>
> Oops, I thought you meant for parse errors. That won't tell you about
> anything else unfortunately.
Ah, don't "oops" anything! That tip was worth its weight in gold to me!
In fact, it told me where one of the typos was that was causing a syntax
error during the initial parsing. The other typo was more insidious (trying
to use count() as $count()), but just as deadly to the output.
Thanks for the great tips!
Jon
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
> Chris wrote:
>> Ronald Wiplinger wrote:
>>> My php program is working with Firefox, but not with Internet Explorer.
>> Nothing to do with php, your problem is javascript.
>>
>>> Is there a tool to find the problem?
>> For IE, try
>>
>> http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en
>>
>>
>
> Why do you guys assume javascript
>
> I am disappointed
drop the disappointment. your new to the game and most of the people on this
list that regularly answer the kind of questions you (will) pose are very
experienced and knowledgable. you may not always like what they say or how, but
trust that your going to get a lot of good quality advice from some smart
people.
... and your getting it for free, some of these guys charge hundreds of dollars
commercially for the kind of help they hand out here for free, mostly their here
wanting to teach newcomers how become decent coders which sometimes means
telling
them stuff they dont really want to hear.
so dont be put off so easily .. one day you might one of those old gaurds that
occasionally loses it after reading the umpteenth stupid question or ungrateful
reply :-)
have fun :-)
--- End Message ---
--- Begin Message ---
Al wrote:
> Install the Firefox extension "HTML Validator". It does a real time Tidy
> check for every page.
good advice.
>
> Make your code W3C compatible and it'll work on all modern browsers.
less good advice. I agree you should be doing everything to make your code
validate 100% BUT having 100% valid code doesn't garantee jack about it
working on all browsers.
that said not having 100% validated HTML means you have nothing to
base anything on ... so the only sane option is to validate and then
work out any problems you have from that point.
And Al does implie an important point, namely that most errors will indeed
never surface when your HTML validates.
>
> Ronald Wiplinger wrote:
>> My php program is working with Firefox, but not with Internet Explorer.
>>
>> I cannot see anything I did wrong, like forgotten " or > where Firefox
>> is more forgiving than IE.
>>
>> I used the error console from Firefox combined with a lynx output to see
>> what line it is.
>>
>> The error output in IE is:
>>
>> Line: 2
>> Char: 104
>> Error: Object doesn't support this property or method
>> Code: 0
>> URL: http://xxx.xxx.xx/mypage.php
>>
>>
>> In Firefox:
>> Line 225
>> Field has no properties
>> http://xxx.xxx.xx/mypage.php
>>
>>
>> Not even the same line!!! Line 114 ~ 250 is a long comment!
>>
>> Is there a tool to find the problem?
>>
>> bye
>>
>> Ronald
>>
>
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
> I got a larger file which consists of lines with a defined length of 56
how large? for very big files it's dangerous to read them in all at once,
as was exampled in other replies. I would say that large in this case would
be anything bigger than 5 Mb (this is a very rough estimate, we could have
a whole thread devoted to this [issue])
> characters. Each line ends with a line feed (0A),
>
> From each line I want one field from position 1 ~ 5 and field 2 from
> position 7 ~ 46.
>
your uisng php5 I hope? if so (error checking code left as an
exercise to the reader):
<?php
foreach (array_filter(explode("\n", file_get_contents($myFile))) as $line) {
echo substr($theDataLine[$i], 0, 5), " - ",
substr($theDataLine[$i], 7, 46),"\n";
}
?>
low flying tip: http://php.net/<search_param/func_name/extension_name/etc>
http://php.net/foreach
http://php.net/array_filter
http://php.net/explode
http://php.net/file_get_contents
http://php.net/substr
RTFM is a mantra not an insult!
> I tried:
>
> $myFile = "plaiso";
> $fh = fopen($myFile, 'r');
> $theDataLine = explode("\n",fgets($fh));
>
> echo "Field1 Field2<p>"; // headline
>
> for($i=0;$i<count($theDataLine);$i++){
>
> $Field1 = substr($theDataLine[$i], 0, 5);
> $Field2 = substr($theDataLine[$i], 7, 46);
> echo "$Field1 $Field2";
> }
>
> It prints only the headline and the first record.
>
> What do I miss?
>
> bye
>
> Ronald
>
--- End Message ---
--- Begin Message ---
hi Nir,
I think you should direct this question to [EMAIL PROTECTED]
(the php core developers list).
Rachmel, Nir (Nir) wrote:
> Hi,
>
> I am running PHP 5.2.3 as a statically compiled module for a web server
> (appWeb, which is an embbeded apache-like server).
> My platform is a ppc processor, running Windriver Linux.
>
> The problem I encounter is, that when printing many syslogs to the
> system my web-server crashes.
>
> I have backtraced the problem to a specific call to a 'free' system call
> in the syslog.c extension:
>
> PHP_FUNCTION(openlog)
> {
> char *ident;
> long option, facility;
> int ident_len;
>
> if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident,
> &ident_len, &option, &facility) == FAILURE) {
> return;
> }
> if (BG(syslog_device)) {
> free(BG(syslog_device));
> }
> BG(syslog_device) = zend_strndup(ident, ident_len);
> openlog(BG(syslog_device), option, facility);
> RETURN_TRUE;
> }
>
> has anyone run into a same problem... or have any ideas as to how to
> resolve this?
>
> Thanks in advance, Nir.
>
--- End Message ---
--- Begin Message ---
I came across this page today:
http://reinholdweber.com/?p=3
It covers a lot of flammable material (echo vs. print) but I wonder
how valid some of the advice is. Can anyone elaborate? Thanks.
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
--- End Message ---
--- Begin Message ---
On Tue, 2007-11-13 at 23:37 +0200, Dotan Cohen wrote:
> I came across this page today:
> http://reinholdweber.com/?p=3
>
> It covers a lot of flammable material (echo vs. print) but I wonder
> how valid some of the advice is. Can anyone elaborate? Thanks.
Some of it is definitely useful individually. Others are questionably
useful individually (echo vs print). But if like me, you adhere to most
of the optimizations as second nature, the cumulative effect is probably
perceptible. Going back and changing code to reflect some of the
optimizations though is probably not worth it.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On 11/13/07, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> I came across this page today:
> http://reinholdweber.com/?p=3
>
> It covers a lot of flammable material (echo vs. print) but I wonder
> how valid some of the advice is. Can anyone elaborate? Thanks.
funny you should post this, I've recently been compiling a list and
trying to assign "weights" to them, based on different sites around
the web. ideally I'd like to get into showing the number of opcodes
for each operation and comparing it based on that (like Sara Golemon
did in her post)
http://michaelshadle.com/php-optimization/
I haven't formatted it all nicely yet, since I have to manually do it
inside of the WP editor. I thought about pulling it into a separate
page, or even making an interactive page where people can submit their
findings and code and vote based on their own knowledge or experience.
--- End Message ---
--- Begin Message ---
I have some more benchmarks for your list if you're interested:
http://www.garfieldtech.com/blog/magic-benchmarks
On Tuesday 13 November 2007, mike wrote:
> On 11/13/07, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> > I came across this page today:
> > http://reinholdweber.com/?p=3
> >
> > It covers a lot of flammable material (echo vs. print) but I wonder
> > how valid some of the advice is. Can anyone elaborate? Thanks.
>
> funny you should post this, I've recently been compiling a list and
> trying to assign "weights" to them, based on different sites around
> the web. ideally I'd like to get into showing the number of opcodes
> for each operation and comparing it based on that (like Sara Golemon
> did in her post)
>
> http://michaelshadle.com/php-optimization/
>
> I haven't formatted it all nicely yet, since I have to manually do it
> inside of the WP editor. I thought about pulling it into a separate
> page, or even making an interactive page where people can submit their
> findings and code and vote based on their own knowledge or experience.
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
On 14/11/2007, Larry Garfield <[EMAIL PROTECTED]> wrote:
> I have some more benchmarks for your list if you're interested:
>
> http://www.garfieldtech.com/blog/magic-benchmarks
>
Thanks, there is some food for though there. I'll also benchmark some
of them and see what I come up with.
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
--- End Message ---
--- Begin Message ---
If anyone recommends anyone well versed in PHP in their network, in or
around San Francisco, please send them along to me Chris Cox @
[EMAIL PROTECTED] Thank you in advance for your consideration.
www.stepup.com
Sincerely,
Chris Cox
Intuit
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 13, 2007 8:32 AM
To: [EMAIL PROTECTED]
Subject: php-general Digest 13 Nov 2007 16:31:50 -0000 Issue 5126
php-general Digest 13 Nov 2007 16:31:50 -0000 Issue 5126
Topics (messages 264417 through 264445):
Re: Which is the best windows IDE for PHP ?
264417 by: Andrew O. Shadoura
264418 by: mvh
264419 by: Chris
264421 by: David Calkins
264431 by: Al
Session problem on PHP/Debian
264420 by: Riviere Guillaume
Re: Question about arrays
264422 by: Jim Lucas
264433 by: Jason Pruim
Re: Returned mail: User unknown
264423 by: Jim Lucas
264438 by: Daniel Brown
264439 by: tedd
264441 by: Daniel Brown
264443 by: Philip Thompson
Problem retrieving $_POST values
264424 by: Jon Westcot
264425 by: Chris
264429 by: Jon Westcot
264430 by: Chris
264442 by: Philip Thompson
Re: PHP ide?
264426 by: Peter Ford
Re: enhanced_list_box
264427 by: kNish
Re: Need a hint how to track an error
264428 by: Robin Vickery
264434 by: Al
Jobs in Frederick, MD
264432 by: Christoph Boget
PHP Job in Curitiba, Brasil
264435 by: Marcelo Wolfgang
Simple reading a file and extract fields
264436 by: Ronald Wiplinger
264437 by: David Calkins
264445 by: Al
Re: Trigger an action on session timeout - feature request?
264440 by: Philip Thompson
PHP 5.2.3 segfault with syslog standard extension
264444 by: Rachmel, Nir (Nir)
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]
----------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
If anyone recommends anyone well versed in PHP in their network, in or
around San Francisco, please send them along to me Chris Cox @
[EMAIL PROTECTED] Thank you in advance for your consideration.
www.stepup.com
Sincerely,
Chris Cox
Intuit
--- End Message ---
--- Begin Message ---
OK, I'm looking at the PHPEclipse site, and I've been here before: the current
Using PHPEclipse document lists the system requirements as PHP 5.1.2 or *below*,
and Apache 2.0 or *below*
Is that just badly out-of-date (last update is April 2007), or is PHPEclipse
really not able to support PHP 5.2.4 and Apache 2.2.4 (my current system
levels)?
Ask the phpeclipse guys, they write the requirements and will be able to
tell you what's going on with that.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Hi all:
This may or may not be a PHP-related question, but, since I'm coding with
PHP, I thought I'd ask:
When a form loads, such as a login form, I'd like to have the cursor placed
automatically in the Username field. Right now, it requires me to click it
with the mouse or to tab into it. I know I've seen this type of cursor control
accomplished on countless web pages, but I can't find any hints on how to
accomplish this on my own. Can one of you wonderful code wizards point me in
the right direction?
Also, while I'm asking questions, let me ask another one: I've seen several
pages (frequently, pages that come up after a login page has been filled out)
that provide some user mollification (you know, the typical "Please be patient,
don't get your nylons in a knot, we're typing as fast as we can" message),
often with some type of moving text or graphics (probably an animated GIF) that
then goes away after a certain time and a third page is displayed. I know that
the headers("Location") code can do this, but I was under the (probably
mistaken) impression that this will NOT work if information has already been
displayed on the page. If that's the case, how are these other pages doing
this? Knowing how to move from page to page this way would really be helpful.
Thanks so much.
Jon
--- End Message ---
--- Begin Message ---
you want javascript.
i'd recommend using jquery (jquery.com)
put an id="username" on the username box.
then do
<script type="text/javascript">
$(document).ready(function() {
$("#username").focus();
});
</script>
voila
On 11/13/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> Hi all:
>
> This may or may not be a PHP-related question, but, since I'm coding with
> PHP, I thought I'd ask:
>
> When a form loads, such as a login form, I'd like to have the cursor
> placed automatically in the Username field. Right now, it requires me to
> click it with the mouse or to tab into it. I know I've seen this type of
> cursor control accomplished on countless web pages, but I can't find any
> hints on how to accomplish this on my own. Can one of you wonderful code
> wizards point me in the right direction?
>
> Also, while I'm asking questions, let me ask another one: I've seen
> several pages (frequently, pages that come up after a login page has been
> filled out) that provide some user mollification (you know, the typical
> "Please be patient, don't get your nylons in a knot, we're typing as fast as
> we can" message), often with some type of moving text or graphics (probably
> an animated GIF) that then goes away after a certain time and a third page is
> displayed. I know that the headers("Location") code can do this, but I was
> under the (probably mistaken) impression that this will NOT work if
> information has already been displayed on the page. If that's the case, how
> are these other pages doing this? Knowing how to move from page to page this
> way would really be helpful.
>
> Thanks so much.
>
> Jon
>
--- End Message ---
--- Begin Message ---
Hi Mike:
> you want javascript.
>
> i'd recommend using jquery (jquery.com)
I'll look into this. Thanks.
> put an id="username" on the username box.
>
> then do
>
> <script type="text/javascript">
> $(document).ready(function() {
> $("#username").focus();
> });
> </script>
>
> voila
Hmmm. It didn't work for me. Do I need to change any of the code you
provided or should it work as you wrote it?
Thanks, though, for the code snippet. I'll look up its pieces to see if
I can figure out what isn't working for me.
Jon
--- End Message ---
--- Begin Message ---
i don't believe so. it should trigger the focus event for that element ID.
of course you did download and include jquery.js in your page... can
you send me (off list) the URL to the page? i can help you out, but it
is off topic to PHP now :)
On 11/13/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> Hi Mike:
>
> > you want javascript.
> >
> > i'd recommend using jquery (jquery.com)
>
> I'll look into this. Thanks.
>
> > put an id="username" on the username box.
> >
> > then do
> >
> > <script type="text/javascript">
> > $(document).ready(function() {
> > $("#username").focus();
> > });
> > </script>
> >
> > voila
>
> Hmmm. It didn't work for me. Do I need to change any of the code you
> provided or should it work as you wrote it?
>
> Thanks, though, for the code snippet. I'll look up its pieces to see if
> I can figure out what isn't working for me.
>
> Jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
At 4:46 PM -0700 11/13/07, Jon Westcot wrote:
Hi all:
This may or may not be a PHP-related question, but, since I'm
coding with PHP, I thought I'd ask:
When a form loads, such as a login form, I'd like to have the
cursor placed automatically in the Username field. Right now, it
requires me to click it with the mouse or to tab into it. I know
I've seen this type of cursor control accomplished on countless web
pages, but I can't find any hints on how to accomplish this on my
own. Can one of you wonderful code wizards point me in the right
direction?
It's a javascript thing -- check out onFocus:
http://www.w3schools.com/jsref/jsref_onfocus.asp
http://www.htmlcodetutorial.com/document/_BODY_onFocus.html
Also, while I'm asking questions, let me ask another one: I've
seen several pages (frequently, pages that come up after a login
page has been filled out) that provide some user mollification (you
know, the typical "Please be patient, don't get your nylons in a
knot, we're typing as fast as we can" message), often with some type
of moving text or graphics (probably an animated GIF) that then goes
away after a certain time and a third page is displayed.
Here's a collection of animated wait gifs:
http://webbytedd.com/bb/wait/
Steal as you need -- I did.
I know that the headers("Location") code can do this, but I was
under the (probably mistaken) impression that this will NOT work if
information has already been displayed on the page. If that's the
case, how are these other pages doing this? Knowing how to move
from page to page this way would really be helpful.
Check out php sessions for passing data between pages.
http://www.php.net/session
http://www.tizag.com/phpT/phpsessions.php
HTH's
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Jon Westcot wrote:
Hi Mike:
you want javascript.
i'd recommend using jquery (jquery.com)
I'll look into this. Thanks.
put an id="username" on the username box.
then do
<script type="text/javascript">
$(document).ready(function() {
$("#username").focus();
});
</script>
voila
Hmmm. It didn't work for me. Do I need to change any of the code you
provided or should it work as you wrote it?
It only works if you have included the jquery javascript files.
If you don't want to use that you could do something like:
<script defer>
document.getElementById('username').focus();
</script>
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
yeah, but adding in jquery will open up his entire world :)
the example below will work without jquery. personally though i try to
stick with jquery since i usually need it for more throughout my site.
On 11/13/07, Chris <[EMAIL PROTECTED]> wrote:
> It only works if you have included the jquery javascript files.
>
> If you don't want to use that you could do something like:
>
> <script defer>
> document.getElementById('username').focus();
> </script>
--- End Message ---
--- Begin Message ---
Hi Mike, Chris, et al.:
Thanks for the info. I'm not certain if I'll be needing jquery, or what
benefits it might afford me with my meager little project, but I will check
it out.
In the meantime, Chris's snippet worked like a charm! Thanks!
Jon
--- End Message ---
--- Begin Message ---
Hi Tedd:
> > Also, while I'm asking questions, let me ask another one: I've
> >seen several pages (frequently, pages that come up after a login
> >page has been filled out) that provide some user mollification (you
> >know, the typical "Please be patient, don't get your nylons in a
> >knot, we're typing as fast as we can" message), often with some type
> >of moving text or graphics (probably an animated GIF) that then goes
> >away after a certain time and a third page is displayed.
>
> Here's a collection of animated wait gifs:
>
> http://webbytedd.com/bb/wait/
>
> Steal as you need -- I did.
Thanks. I'll check that out. I'm still wondering, though, how the
redirection works if it is supposed to occur only before any text appears in
the <BODY>.
> >I know that the headers("Location") code can do this, but I was
> >under the (probably mistaken) impression that this will NOT work if
> >information has already been displayed on the page. If that's the
> >case, how are these other pages doing this? Knowing how to move
> >from page to page this way would really be helpful.
>
> Check out php sessions for passing data between pages.
>
> http://www.php.net/session
> http://www.tizag.com/phpT/phpsessions.php
I guess these will help explain things. Thanks.
Greatly appreciated!
Jon
--- End Message ---
--- Begin Message ---
At 5:49 PM -0800 11/13/07, mike wrote:
yeah, but adding in jquery will open up his entire world :)
It could, but it's an overkill for a simple input field focus thing, IMO.
It's like selling a guy a Hummer because he wants to drive on the
gravel on the side of the road.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
in my experience it never stops at a single focus event on a login box...
but yes, i should have replied with the simpler solution first.
On 11/13/07, tedd <[EMAIL PROTECTED]> wrote:
> At 5:49 PM -0800 11/13/07, mike wrote:
> >yeah, but adding in jquery will open up his entire world :)
>
> It could, but it's an overkill for a simple input field focus thing, IMO.
>
> It's like selling a guy a Hummer because he wants to drive on the
> gravel on the side of the road.
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
--- End Message ---
--- Begin Message ---
At 6:52 PM -0700 11/13/07, Jon Westcot wrote:
> Here's a collection of animated wait gifs:
http://webbytedd.com/bb/wait/
Steal as you need -- I did.
Thanks. I'll check that out. I'm still wondering, though, how the
redirection works if it is supposed to occur only before any text appears in
the <BODY>.
Don't confuse yourself -- it's simpler than your trying to make it.
You show the wait gif in the preceding (or current) page and it's not
a redirect.
It's simply:
1) The user enters a bunch of data and hits submit;
2) The form then sends that data to the server;
3) The form sticks around showing you a wait gif until the server
responds with a new page.
4) You don't need a wait gif for the new page.
OR
I use javascript to pre-process the data and do basically the same thing.
Here's a *required* entry form using javascript.
http://webbytedd.com/c/form-submit/
If the calculations in the background are significant with respect to
time, then I would throw up a wait gif instead of an alert.
However, I seldom write anything that takes that much time -- so it's
usually a moot point.
Here's another example:
http://webbytedd.com/c/form-calc/
I haven't seen too many forms that get more complex than that and the
computations there are instant -- so what's the point of a wait gif
in form processing?
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
1) window.onload = function () {formfield.focus();}
2) Meta refresh or some combination of Javascript, flush(), and
ob_flush().
On Nov 13, 2007, at 3:46 PM, "Jon Westcot" <[EMAIL PROTECTED]> wrote:
Hi all:
This may or may not be a PHP-related question, but, since I'm
coding with PHP, I thought I'd ask:
When a form loads, such as a login form, I'd like to have the
cursor placed automatically in the Username field. Right now, it
requires me to click it with the mouse or to tab into it. I know
I've seen this type of cursor control accomplished on countless web
pages, but I can't find any hints on how to accomplish this on my
own. Can one of you wonderful code wizards point me in the right
direction?
Also, while I'm asking questions, let me ask another one: I've
seen several pages (frequently, pages that come up after a login
page has been filled out) that provide some user mollification (you
know, the typical "Please be patient, don't get your nylons in a
knot, we're typing as fast as we can" message), often with some type
of moving text or graphics (probably an animated GIF) that then goes
away after a certain time and a third page is displayed. I know
that the headers("Location") code can do this, but I was under the
(probably mistaken) impression that this will NOT work if
information has already been displayed on the page. If that's the
case, how are these other pages doing this? Knowing how to move
from page to page this way would really be helpful.
Thanks so much.
Jon
--- End Message ---
--- Begin Message ---
I added just into a input field"
19" enclosure
which was displayed from the database as:
19\" enclosure
That gives me some questions:
1. where the protecting slash comes from?
2. how can I get it away when I want to display that field?
3. The slash is not to see in phpmyadmin, why not?
and:
1. what else do I need to take care with input fields and if they are
going to a mysql database?
2. can I use a function for that kind of protection for each field - or
even better just flag it in php to protect?
3. is HTTP_REFERER & session-id enough to make sure that no variables
can be injected?
bye
Ronald
--- End Message ---
--- Begin Message ---
1.Probably that's because the function mysql_real_escape_string() is turned on.
You can check that in your php.ini configuration.
2. If you want to display them as you wanted, you can use stripcslashes() on
your output contents.
3. Maybe phpmyadmin automatically stripped that out.
And
1. Any user input should be escaped before they went to database.
You can use htmlentities(), addslashes(), strip_tags(), etc...
2. You can encapsule those functions in a function, and use it for each user
input.
3. No sure. Probably they do.
Anybody any ideas?
Regards,
Shelley
-----Original Message-----
From: Ronald Wiplinger [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 14, 2007 9:52 AM
To: PHP General list
Subject: [PHP] Input field
I added just into a input field"
19" enclosure
which was displayed from the database as:
19\" enclosure
That gives me some questions:
1. where the protecting slash comes from?
2. how can I get it away when I want to display that field?
3. The slash is not to see in phpmyadmin, why not?
and:
1. what else do I need to take care with input fields and if they are going to
a mysql database?
2. can I use a function for that kind of protection for each field - or even
better just flag it in php to protect?
3. is HTTP_REFERER & session-id enough to make sure that no variables can be
injected?
bye
Ronald
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
I added just into a input field"
19" enclosure
which was displayed from the database as:
19\" enclosure
That gives me some questions:
1. where the protecting slash comes from?
Probably magic_quotes_gpc
2. how can I get it away when I want to display that field?
1) Turn off magic_quotes_gpc in a htaccess file:
php_flag magic_quotes_gpc 0
2) When you insert the data, use mysql_real_escape_string
3) When you display the data, use htmlspecialchars or htmlentities
3. The slash is not to see in phpmyadmin, why not?
It probably has code to pick up magic_quotes_gpc and work around it.
1. what else do I need to take care with input fields and if they are
going to a mysql database?
Use mysql_real_escape_string
2. can I use a function for that kind of protection for each field - or
even better just flag it in php to protect?
There is no flag, you need to use escape_string for each field.
3. is HTTP_REFERER & session-id enough to make sure that no variables
can be injected?
No way. Never ever ever ever trust user data (did I mention never
ever?). Authenticated users can do just as much damage as an
unauthenticated user.
Read http://phpsec.org/projects/guide/ before you touch any more code.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---