Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread David Hutto
On Sat, Mar 12, 2011 at 2:34 AM, Tommy Pham  wrote:
> On Fri, Mar 11, 2011 at 11:26 PM, David Hutto  wrote:
>> On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham  wrote:
>>> On Fri, Mar 11, 2011 at 10:34 PM, David Hutto  wrote:
 Although, right now, if I were going to be using all of those
 languages in unison(and I am), then I'd go with C, and spit them out
 to the browser for lower level control, as well as, to remain familiar
 with some of the main languages being used currently.

>>>
>>> But then how portable is your app?
>>>
>>
>> I'd have to refer to your reply:
>>
>> "This would depend on the original application design & code."
>>
>> If the original app is meant for specific hardware, and a specific
>> company, then portability is null point.
>>
>
> If that's the case why even bother with PHP?  Why not just do it in C
> for pure speed?

Speed wasn't the point- Multiple technology usage was the point. And
if you're going to poise a browser for multiple intercepts(in terms of
languages), then C *seems* to be the best was to move toward the
displayment of it's descendants.

If it's going to be a multi-language project, then it needs to be
addressed with a multilanguage source to stem from, and C would seem
like the optimum epicenter for propagation of this.


I thought one of the major points of PHP is 'develop


> anywhere and deploy anywhere'.
>

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread Tommy Pham
On Fri, Mar 11, 2011 at 11:26 PM, David Hutto  wrote:
> On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham  wrote:
>> On Fri, Mar 11, 2011 at 10:34 PM, David Hutto  wrote:
>>> Although, right now, if I were going to be using all of those
>>> languages in unison(and I am), then I'd go with C, and spit them out
>>> to the browser for lower level control, as well as, to remain familiar
>>> with some of the main languages being used currently.
>>>
>>
>> But then how portable is your app?
>>
>
> I'd have to refer to your reply:
>
> "This would depend on the original application design & code."
>
> If the original app is meant for specific hardware, and a specific
> company, then portability is null point.
>

If that's the case why even bother with PHP?  Why not just do it in C
for pure speed?  I thought one of the major points of PHP is 'develop
anywhere and deploy anywhere'.

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread David Hutto
On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham  wrote:
> On Fri, Mar 11, 2011 at 10:34 PM, David Hutto  wrote:
>> Although, right now, if I were going to be using all of those
>> languages in unison(and I am), then I'd go with C, and spit them out
>> to the browser for lower level control, as well as, to remain familiar
>> with some of the main languages being used currently.
>>
>
> But then how portable is your app?
>

I'd have to refer to your reply:

"This would depend on the original application design & code."

If the original app is meant for specific hardware, and a specific
company, then portability is null point.

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread Tommy Pham
On Fri, Mar 11, 2011 at 10:34 PM, David Hutto  wrote:
> Although, right now, if I were going to be using all of those
> languages in unison(and I am), then I'd go with C, and spit them out
> to the browser for lower level control, as well as, to remain familiar
> with some of the main languages being used currently.
>

But then how portable is your app?

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread Tommy Pham
On Fri, Mar 11, 2011 at 10:31 PM, David Hutto  wrote:
> On Sat, Mar 12, 2011 at 1:21 AM, Tommy Pham  wrote:
>> I think the OP is having both PHP & JS codes mixed and scattered all
>> over the page.  If chunked-encoding used without any ob*
>> implementation, then that's the problem he'll experience.
>>
>> Richard,
>>
>> I recommend to put the $(document).ready() and any JS scriptlets
>> within  tags at the very bottom of the HTML document just
>> right before .  This would allow the mixed PHP/HTML to finish
>> without creating problems for your JS code(s).
>
> Why not separate them all, i.e. js, php, html, and if it was in there,
> css. If you can use them all, then separating them out should be
> *easy*(I still would have to use references for that many languages).
> Think of it as an expository writing, with the includes being the main
> topics, the content being composed of these higher ideas, and the
> conclusion, just closing it out.
>
> Pick the focus, I'd say php, and echo the rest out. Or html, and
> include the php, css and js.
>

This would depend on the original application design & code.  The
solution you're proposing is ideal which, for the most part, would
probably require the app redesign/rewrite.  However, if Richard isn't
one of the originator(s) of the app's developers or he's only
experiencing the problem on a very few limited pages, moving the JS
codes to the bottom would be a faster fix.  In the end, it all depends
on his environment and immediate need.

>
>
>  The other solution is
>> implement output buffer using ob* functions.
>>
>> Regards,
>> Tommy
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> According to theoretical physics, the division of spatial intervals as
> the universe evolves gives rise to the fact that in another timeline,
> your interdimensional counterpart received helpful advice from me...so
> be eternally pleased for them.
>

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread David Hutto
On Sat, Mar 12, 2011 at 1:21 AM, Tommy Pham  wrote:
> I think the OP is having both PHP & JS codes mixed and scattered all
> over the page.  If chunked-encoding used without any ob*
> implementation, then that's the problem he'll experience.
>
> Richard,
>
> I recommend to put the $(document).ready() and any JS scriptlets
> within  tags at the very bottom of the HTML document just
> right before .  This would allow the mixed PHP/HTML to finish
> without creating problems for your JS code(s).

Why not separate them all, i.e. js, php, html, and if it was in there,
css. If you can use them all, then separating them out should be
*easy*(I still would have to use references for that many languages).
Think of it as an expository writing, with the includes being the main
topics, the content being composed of these higher ideas, and the
conclusion, just closing it out.

Pick the focus, I'd say php, and echo the rest out. Or html, and
include the php, css and js.



 The other solution is
> implement output buffer using ob* functions.
>
> Regards,
> Tommy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread David Hutto
Although, right now, if I were going to be using all of those
languages in unison(and I am), then I'd go with C, and spit them out
to the browser for lower level control, as well as, to remain familiar
with some of the main languages being used currently.

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



Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish

2011-03-11 Thread Tommy Pham
I think the OP is having both PHP & JS codes mixed and scattered all
over the page.  If chunked-encoding used without any ob*
implementation, then that's the problem he'll experience.

Richard,

I recommend to put the $(document).ready() and any JS scriptlets
within  tags at the very bottom of the HTML document just
right before .  This would allow the mixed PHP/HTML to finish
without creating problems for your JS code(s).  The other solution is
implement output buffer using ob* functions.

Regards,
Tommy

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



Re: [PHP] Check for open file

2011-03-11 Thread Tommy Pham
On Fri, Mar 4, 2011 at 7:09 AM, Steve Staples  wrote:

>
> Depending on the size of the file, wouldn't this fall under the 2gb
> limitation on windows 32bit OS?  I ran into this problem on a project I
> was working on, and ended up switching to Python (but that is a WHOLE
> other conversation)
>
> just food for thought, since I am not sure of the size of files they are
> dealing with.
>
> Steve
>
>

Jumping in late.  I've been too busy.

Steve,

I think you're probably referring to FAT32 file system.  IIRC, NTFS
doesn't have that low limit. [1]

Regards,
Tommy

[1] http://technet.microsoft.com/en-us/library/cc938937.aspx

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



Re: [PHP] Zend Framework - getParam() Question

2011-03-11 Thread Midhun Girish
You can also try routing in zend..
http://codeutopia.net/blog/2007/11/16/routing-and-complex-urls-in-zend-framework/

Midhun Girish



On Sat, Mar 12, 2011 at 11:16 AM, NetEmp  wrote:

> Hi Dan
>
> One method for this is to use URL Rewriting (which can be implemented on
> Apache using htaccess).
>
> Through URL Rewriting you can first make the following URL:
>
> http://www.website.com/article-clean-url
>
> to internally behave as the
> following:
>
> http://www.website.com/index/user/ 1
>
> and then you can use the same
> getParam
> method to grab the value and carry out further processing.
>
> Hope this helps.
>
> Cheers
>
> NetEmp
>
> On Sat, Mar 12, 2011 at 10:04 AM, Dan Joseph  wrote:
>
> > Hi Everyone,
> >
> > Zend Framework getParam question
> >
> > I'm trying to get a value from the url...
> >
> > I know how to grab:
> >
> > http;//www.website.com/index/user/1
> >
> > that's the index controller, $this->_getParam('user'); (value = 1)..
> >
> > What I'd like to be able to grab is just off one thing from the url...
> > example..  I want to give an article a unique/clean url... so, when I go
> > to:
> >
> > http://www.website.com/article-clean-url
> >
> > I can somehow grab that 'article-clean-url' as a value and use it for a
> > lookup in the database.
> >
> > I've tried everything and search all over the place.  I can't find the
> > answer.  Can someone tell me how this is done?  Thanks...
> >
> > --
> > -Dan Joseph
> >
>


Re: [PHP] Zend Framework - getParam() Question

2011-03-11 Thread NetEmp
Hi Dan

One method for this is to use URL Rewriting (which can be implemented on
Apache using htaccess).

Through URL Rewriting you can first make the following URL:

http://www.website.com/article-clean-url

to internally behave as the
following:

http://www.website.com/index/user/ 1

and then you can use the same getParam
method to grab the value and carry out further processing.

Hope this helps.

Cheers

NetEmp

On Sat, Mar 12, 2011 at 10:04 AM, Dan Joseph  wrote:

> Hi Everyone,
>
> Zend Framework getParam question
>
> I'm trying to get a value from the url...
>
> I know how to grab:
>
> http;//www.website.com/index/user/1
>
> that's the index controller, $this->_getParam('user'); (value = 1)..
>
> What I'd like to be able to grab is just off one thing from the url...
> example..  I want to give an article a unique/clean url... so, when I go
> to:
>
> http://www.website.com/article-clean-url
>
> I can somehow grab that 'article-clean-url' as a value and use it for a
> lookup in the database.
>
> I've tried everything and search all over the place.  I can't find the
> answer.  Can someone tell me how this is done?  Thanks...
>
> --
> -Dan Joseph
>


[PHP] Zend Framework - getParam() Question

2011-03-11 Thread Dan Joseph
Hi Everyone,

Zend Framework getParam question

I'm trying to get a value from the url...

I know how to grab:

http;//www.website.com/index/user/1

that's the index controller, $this->_getParam('user'); (value = 1)..

What I'd like to be able to grab is just off one thing from the url...
example..  I want to give an article a unique/clean url... so, when I go to:

http://www.website.com/article-clean-url

I can somehow grab that 'article-clean-url' as a value and use it for a
lookup in the database.

I've tried everything and search all over the place.  I can't find the
answer.  Can someone tell me how this is done?  Thanks...

-- 
-Dan Joseph


Re: [PHP] Re: $_POST variable

2011-03-11 Thread Kirk Bailey



On 3/11/2011 2:43 PM, Geoff Lane wrote:

[snip]

You could use foreach to iterate through the post variables until you
encounter a match:

foreach ($_POST as $key =>  $value){
 if (substr($key, 0, 6) == "radio_") {
$buttonName = $key;
$buttonValue = 4value;
break 2;
 }
}

I haven't tried the above code, but I hope someone will correct my
efforts if I'm wrong.


ok, now I am very new to php, so if i got this wrong be nice.

It APPEARS TO ME that you are setting a variable called buttonName 
to the extracted value stored in $key for each name in the post 
submission, and a variable named buttonValue for the item's value. 
THEM, you do the same thing again to the same destination variables 
for the next name/value pair, and so-on until they list of 
name/value pairs is exhausted. IF this understanding is correct, 
only the LAST name/value pair will emerge from the process intact; 
prior values will be obliterated. Would they not be better to append 
them to a single dimensioned array, which starts life as a null 
array? If I am getting this wrong, please administer wet mackerel 
therapy to my tired head and explain the facts.


--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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



[PHP] web site link request

2011-03-11 Thread Kirk Bailey
May I have suggestions of websites I would do well to visit to 
improve my php skills? Links please, with a breif description if you 
would be so good.


--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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



Re: [PHP] Possible to pinpoint peak memory usage?

2011-03-11 Thread Daniel Hong
Nice. I will give XHProf a try. Thanks!

-daniel

On Fri, Mar 11, 2011 at 12:04 PM, David Harkness
wrote:

> On Fri, Mar 11, 2011 at 11:35 AM, Daniel Hong wrote:
>
>> Is it possible to pinpoint the location where the most memory was used?
>
>
> Take a look at XHProf. [1] It will track memory and time of all function
> calls. Paul Reinheimer created a GUI [2] to make dealing with the data
> easier.
>
> Peace,
> David
>
> [1] http://mirror.facebook.net/facebook/xhprof/doc.html
> [2]
> http://blog.preinheimer.com/index.php?/archives/355-A-GUI-for-XHProf.html
>
>


Re: [PHP] Re: $_POST variable

2011-03-11 Thread Shawn McKenzie
On 03/11/2011 02:33 PM, Jim Lucas wrote:
> On 3/11/2011 12:03 PM, Shawn McKenzie wrote:
>> On 03/11/2011 01:28 PM, Danny wrote:
>>> Hi guys,
>>>
>>> I have a form that has a long list of radio-bottons inside of it. The
>>> radio-buttons are dynamically created via php and MySQL.
>>>
>>> Here is an example of one of the radio buttons:
>>>
>>> " 
>>> value="0">
>>> " 
>>> value="1">
>>>
>>> Now, when I submit this form to another page for processing, how would I 
>>> "catch"
>>> the above radio-button's $_POST name since I do not know the name, only 
>>> that it
>>> starts with "radio_" ?
>>>
>>> Thank You
>>>
>>> Danny
>>
>> The most common and flexible way to do this sort of thing is to use
>> arrays instead:
>>
>> > value="0">
>> > value="1">
>>
>>
>> Then:
>>
>> foreach($_POST['radio'] as $key => $value) {
>>echo "radio for $key is $value";
>> }
> 
> Your example would be good if the OP wanted checkbox'es.  But with radio
> buttons, the whole point (most of the time) is to have the form only allow you
> to have one of the radio input fields selected at any given time.  How you
> showed it, it would not see the uniqueness of the radio button names, and
> therefor allow more than one of the radio input fields to be selected at a 
> time.

One radio button of the same name selected at a time yes.  From the OP's
code of two radios, one with value 0 and one with value 1, I assumed
these were to be a pair with the same name with only one able to be
successful.  This extends to arrays as well:







This works as expected, the same as the code I posted.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: $_POST variable

2011-03-11 Thread Jim Lucas
On 3/11/2011 12:03 PM, Shawn McKenzie wrote:
> On 03/11/2011 01:28 PM, Danny wrote:
>> Hi guys,
>>
>> I have a form that has a long list of radio-bottons inside of it. The
>> radio-buttons are dynamically created via php and MySQL.
>>
>> Here is an example of one of the radio buttons:
>>
>> " 
>> value="0">
>> " 
>> value="1">
>>
>> Now, when I submit this form to another page for processing, how would I 
>> "catch"
>> the above radio-button's $_POST name since I do not know the name, only that 
>> it
>> starts with "radio_" ?
>>
>> Thank You
>>
>> Danny
> 
> The most common and flexible way to do this sort of thing is to use
> arrays instead:
> 
>  value="0">
>  value="1">
> 
> 
> Then:
> 
> foreach($_POST['radio'] as $key => $value) {
>echo "radio for $key is $value";
> }

Your example would be good if the OP wanted checkbox'es.  But with radio
buttons, the whole point (most of the time) is to have the form only allow you
to have one of the radio input fields selected at any given time.  How you
showed it, it would not see the uniqueness of the radio button names, and
therefor allow more than one of the radio input fields to be selected at a time.

I would try something like this:

As long as this is correct:

Zero
One

Then I would do the following:

foreach ($_POST as $k => $v) {
  if ( strpos(trim($k), 'radio_') === 0 ) {
echo $k.' is a match, and it\'s value is '.$v.'.'.PHP_EOL;
  }
}

Jim Lucas

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



Re: [PHP] Re: $_POST variable

2011-03-11 Thread richard gray

You could use foreach to iterate through the post variables until you

encounter a match:

foreach ($_POST as $key =>  $value){
 if (substr($key, 0, 6) == "radio_") {
$buttonName = $key;
$buttonValue = 4value;
break 2;
 }
}

I haven't tried the above code, but I hope someone will correct my
efforts if I'm wrong.

given your code example -> 'break 2;' -- s/b just 'break;'  ... 'break 
2;' is to exit the outer loop of a nested loop which is not the case here.


Rich

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



Re: [PHP] Possible to pinpoint peak memory usage?

2011-03-11 Thread David Harkness
On Fri, Mar 11, 2011 at 11:35 AM, Daniel Hong  wrote:

> Is it possible to pinpoint the location where the most memory was used?


Take a look at XHProf. [1] It will track memory and time of all function
calls. Paul Reinheimer created a GUI [2] to make dealing with the data
easier.

Peace,
David

[1] http://mirror.facebook.net/facebook/xhprof/doc.html
[2]
http://blog.preinheimer.com/index.php?/archives/355-A-GUI-for-XHProf.html


[PHP] Re: $_POST variable

2011-03-11 Thread Shawn McKenzie
On 03/11/2011 01:28 PM, Danny wrote:
> Hi guys,
> 
> I have a form that has a long list of radio-bottons inside of it. The
> radio-buttons are dynamically created via php and MySQL.
> 
> Here is an example of one of the radio buttons:
> 
> " 
> value="0">
> " 
> value="1">
> 
> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it
> starts with "radio_" ?
> 
> Thank You
> 
> Danny

The most common and flexible way to do this sort of thing is to use
arrays instead:





Then:

foreach($_POST['radio'] as $key => $value) {
   echo "radio for $key is $value";
}
-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: [PHP-WEBMASTER] php with htmlspecialchars function

2011-03-11 Thread NetEmp
Well Lisa, that is exactly the way htmlspecialchars is supposed to work.

Here you could also display - Test - without using any function at all,
simply echo "Test"; and this should work well.

NetEmp

On Fri, Mar 11, 2011 at 11:51 PM, Daniel Brown  wrote:

> On Fri, Mar 11, 2011 at 13:07, Lisa Nguyen 
> wrote:
> > Hi
> >
> > I use one of your example to test the htmlspecialchars :
> >
> >  > $new = htmlspecialchars("Test", ENT_QUOTES);
> > echo $new; // Test
> > ?>
> >
> > On my browse, it display like below
> > Test
> >
> > Instead:
> > Test
> >
> > Please help me how display on browse only "Test", not like view source.
>
>First, this isn't a support channel.  Please view
> http://php.net/support for a brief list of available support methods.
> The list you want is PHP General (CC'd on this email, and you can
> subscribe at http://php.net/mailinglists ).
>
>Second, you're using htmlspecialchars(), which is converting the <
> and > to < and > respectively, which will cause the browser to
> display it as if it was source (though viewing the source of that
> would show you the entities).
>
>Instead, check out strip_tags(), which is likely what you want:
>
>http://php.net/strip_tags
>
> --
> 
> Network Infrastructure Manager
> http://www.php.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: $_POST variable

2011-03-11 Thread Geoff Lane
Hi Danny,

On Friday, March 11, 2011, 7:28:10 PM, you wrote:

> I have a form that has a long list of radio-bottons inside of it. The
> radio-buttons are dynamically created via php and MySQL.

> Here is an example of one of the radio buttons:

> " 
> value="0">
> " 
> value="1">

> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it

You could use foreach to iterate through the post variables until you
encounter a match:

foreach ($_POST as $key => $value){
if (substr($key, 0, 6) == "radio_") {
   $buttonName = $key;
   $buttonValue = 4value;
   break 2;
}
}

I haven't tried the above code, but I hope someone will correct my
efforts if I'm wrong.

-- 
Geoff Lane
Cornwall, UK


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



Re: [PHP] $_POST variable

2011-03-11 Thread richard gray

On 11/03/2011 20:28, Danny wrote:

Hi guys,

I have a form that has a long list of radio-bottons inside of it. The
radio-buttons are dynamically created via php and MySQL.

Here is an example of one of the radio buttons:

" 
value="0">
" 
value="1">

Now, when I submit this form to another page for processing, how would I "catch"
the above radio-button's $_POST name since I do not know the name, only that it
starts with "radio_" ?


foreach ($_POST as $k => $v) {
if (substr($k,0,6) == 'radio_') {
echo 'Name is -> ',$k,'';
// Do stuff...
}
}

HTH
Rich

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



Re: [PHP] $_POST variable

2011-03-11 Thread Steve Staples
On Fri, 2011-03-11 at 21:28 +0200, Danny wrote:
> Hi guys,
> 
> I have a form that has a long list of radio-bottons inside of it. The
> radio-buttons are dynamically created via php and MySQL.
> 
> Here is an example of one of the radio buttons:
> 
> " 
> value="0">
> " 
> value="1">
> 
> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it
> starts with "radio_" ?
> 
> Thank You
> 
> Danny
> 

loop thought all the $_POST variables...

foreach($_POST as $key => $val)
{
if(susbtr($key, 0, 7) === "radio_")
{
# this is what we're looking for
}
}

crude, but works... I am sure there are many ways to look for it.

Steve


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



[PHP] Possible to pinpoint peak memory usage?

2011-03-11 Thread Daniel Hong
Hello,

Is it possible to pinpoint the location where the most memory was used? I
log memory_get_peak_usage() in sections of my code where I believe the most
memory would be consumed, but I haven't had luck with getting an accurate
picture. I also log the peak usage at the very end of the code. I can see
memory usage go up in places that I expected it to, but then things are
pretty much flat lined. However, the peak usage at the very end shows a much
higher number, sometimes it could be twice as large.

I'm also tracing with xdebug. At the beginning of the trace memory starts
off low, then it goes up as things are allocated. It also goes back down as
things are deallocated. But never do I see the numbers as high as what PHP
is reporting as the peak. It looks like xdebug traces at every step of
execution, shouldn't the memory usage shown in the trace be the actual usage
for every single step in the code? Why is PHP reporting that peak was much
higher?

Maybe I'm not understanding this stuff correctly?

Thanks,
daniel


Re: [PHP] $_POST variable

2011-03-11 Thread Daniel Brown
On Fri, Mar 11, 2011 at 14:28, Danny  wrote:
[snip!]
>
> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it
> starts with "radio_" ?

One method is a foreach() loop.

 $v) {
if (preg_match('/^radio_/Ui',trim($k))) {
echo $k.' is a match, and it\'s value is '.$v.'.'.PHP_EOL;
}
}
?>

-- 

Network Infrastructure Manager
http://www.php.net/

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



[PHP] $_POST variable

2011-03-11 Thread Danny
Hi guys,

I have a form that has a long list of radio-bottons inside of it. The
radio-buttons are dynamically created via php and MySQL.

Here is an example of one of the radio buttons:

" 
value="0">
" 
value="1">

Now, when I submit this form to another page for processing, how would I "catch"
the above radio-button's $_POST name since I do not know the name, only that it
starts with "radio_" ?

Thank You

Danny

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



[PHP] Re: [PHP-WEBMASTER] php with htmlspecialchars function

2011-03-11 Thread Daniel Brown
On Fri, Mar 11, 2011 at 13:07, Lisa Nguyen  wrote:
> Hi
>
> I use one of your example to test the htmlspecialchars :
>
>  $new = htmlspecialchars("Test", ENT_QUOTES);
> echo $new; // Test
> ?>
>
> On my browse, it display like below
> Test
>
> Instead:
> Test
>
> Please help me how display on browse only "Test", not like view source.

First, this isn't a support channel.  Please view
http://php.net/support for a brief list of available support methods.
The list you want is PHP General (CC'd on this email, and you can
subscribe at http://php.net/mailinglists ).

Second, you're using htmlspecialchars(), which is converting the <
and > to < and > respectively, which will cause the browser to
display it as if it was source (though viewing the source of that
would show you the entities).

Instead, check out strip_tags(), which is likely what you want:

http://php.net/strip_tags

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Issue with Quick Email validation

2011-03-11 Thread NetEmp
Great Going Bob!

Wishing you Lots of Fun ahead!

Cheers

NetEmp

On Fri, Mar 11, 2011 at 12:54 AM,  wrote:

>  Yep, new to programming and starting with php
> -taken classes but don't have the experience yet
>
> Not asking for complete mail addresses probably work best in most
> companies, but we're so used to typing our complete address that I would
> need to have a control and removal of domain -only to add again for sending
> the mail.
>
> Yes the first part of this already has a separate account validation, it
> also logs a request into our internal support system.
> Naturally if a external mail address is filled in there will be no request
> created, and I could have stopped the script there.
> This way I can stop use of external mail, while a contractor that not yet
> have a account in our logging system will still be able to send a Email
> request
>
>
>   At a later stage I might add email validation and even pick up details
> such as phone numbers and titles, but for now this little extra piece was
> sufficient
>
> Thanks again,
> Bob
>
>  -Original Message-
> From: NetEmp 
> To: rquadl...@googlemail.com
> Cc: Richard Quadling ; rob...@myself.com;
> louis.huppenba...@gmail.com; php-general@lists.php.net
> Sent: Thu, Mar 10, 2011 3:46 pm
> Subject: Re: [PHP] Issue with Quick Email validation
>
>  Agreed with the method suggested by Richard here, this is surely a safer
> way.
>
>  @Robert - are you a newbie to PHP or also to web programing.. or as a
> matter of fact to programing..
>
>  Just to share that validating user's input is always advisable, esp. in
> the web world. Thus, even if you use the method suggested by Richard, but I
> shall then also advise you to apply proper validations at the input (like
> permissible characters, maximum length allowed etc..)
>
>  Cheers
>
> On Thu, Mar 10, 2011 at 5:19 PM, Richard Quadling wrote:
>
>>  On 10 March 2011 11:07,   wrote:
>> > Thank you, that did get me past that part!
>> >
>> > Had also to put in else statement to call Email function, without doing
>> so the mail was sent even though giving error
>> >
>> > Robert
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > -Original Message-
>> > From: Louis Huppenbauer 
>> > To: rob...@myself.com
>> > Cc: php-general@lists.php.net
>> > Sent: Thu, Mar 10, 2011 11:38 am
>> > Subject: Re: [PHP] Issue with Quick Email validation
>> >
>> >
>> > try != instead of ==, that should do the trick.
>> >
>> >
>> >
>> > 2011/3/10  :
>> >
>> >> Hi,
>> >
>> >> I'm newbie to PHP and this list, possible not a new question so forgive
>> me if
>> >
>> > it's a repeat
>> >
>> >> I have a form where I want the submitter Email ID to only be from one
>> domain
>> >
>> >>
>> >
>> >> Here's the part I'm having issues with
>> >
>> >>
>> >
>> >>$domain = explode( "@", $who);
>> >
>> >>if ( $domain[1] == "company.com") {
>> >
>> >>echo $domain[1];
>> >
>> >>echo("Email invalid.");
>> >
>> >>exit;
>> >
>> >>}
>> >
>> >>
>> >
>> >> First Echo is just for me to check
>> >
>> >> I type in a correct Email ID, say m...@company.com
>> >
>> >>
>> >
>> >> The return of this is:
>> >
>> >>
>> >
>> >> company.com
>> >
>> >> Email invalid.
>> >> As far as I can see this if statement should not fall in, what am I
>> missing?
>>
>>  Why bother asking for the entire address? Just ask for the name part
>> and display the domain name on the form?
>>
>> Enter your email address: > name="email" id="email" />@company.com
>>
>> sort of thing.
>>
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>