PHP Syntax Help - Check?
am 25.02.2010 05:52:25 von Rick Dwyer
Hello all.
I'm trying to learn PHP on the fly and I have a line of code that
contains syntax I can't find documented anywhere:
php echo check('element8');
In the above line, can someone tell me what "check" means?
Thank you.
--Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 06:16:08 von Robert Cummings
Rick Dwyer wrote:
> Hello all.
>
> I'm trying to learn PHP on the fly and I have a line of code that
> contains syntax I can't find documented anywhere:
>
> php echo check('element8');
>
> In the above line, can someone tell me what "check" means?
In the above, check is a function. It is being called with parameter
'element8'.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 06:31:56 von Paul M Foster
On Thu, Feb 25, 2010 at 12:16:08AM -0500, Robert Cummings wrote:
> Rick Dwyer wrote:
>> Hello all.
>>
>> I'm trying to learn PHP on the fly and I have a line of code that
>> contains syntax I can't find documented anywhere:
>>
>> php echo check('element8');
>>
>> In the above line, can someone tell me what "check" means?
>
>
> In the above, check is a function. It is being called with parameter
> 'element8'.
This is true. But perhaps more importantly, check() is not a native PHP
function. Thus it comes from some other library or group of external
functions.
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 06:52:03 von Rick Dwyer
OK... external function... that would explain why I could not locate it.
Let me get right to the problem I am having with this code as someone
may be able to help directly.
I have a link on a page that opens a contact form. The link is
mypage.php?my_id=5
So on mypage.php, I capture this value with:
$my_id=$_GET['my_id'];
I understand this much. But when the end user submits this contact
form they do so to formcheck.php and if formcheck.php sees a required
field is blank, it throws it back to mypage.php with an alert. BUT, I
lose the value of the variable $my_id. SO, I created a hidden field
on mypate.php with value="" and on
formcheck.php, I added $my_id = $_Post['my_id'];
However, when formcheck.php returns me to mypage.php, $my_id is still
blank.
Very frustrating.
Any help determining what I am doing wrong is greatly appreciated.
Thanks.
--Rick
On Feb 25, 2010, at 12:31 AM, Paul M Foster wrote:
> On Thu, Feb 25, 2010 at 12:16:08AM -0500, Robert Cummings wrote:
>
>> Rick Dwyer wrote:
>>> Hello all.
>>>
>>> I'm trying to learn PHP on the fly and I have a line of code that
>>> contains syntax I can't find documented anywhere:
>>>
>>> php echo check('element8');
>>>
>>> In the above line, can someone tell me what "check" means?
>>
>>
>> In the above, check is a function. It is being called with parameter
>> 'element8'.
>
> This is true. But perhaps more importantly, check() is not a native
> PHP
> function. Thus it comes from some other library or group of external
> functions.
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 07:02:58 von kalinga
if you do the redirection with header('Location: /mypage.php'),
setting a variable on formcheck.php is not enough.
if you modify the header('Location: /mypage.php') to..
header('Location: /mypage.php?my_id=3D5')
it will take the variable to mypage.php as $_GET['my_id]
you can not expect a variable value set in to $_POST array to reflect
on a totally different page without making it a form post (aka use of
proper headers).
i guess, it's time to you to read about session_start() method and the
array $_SESSION available in php :)
~viraj
On Thu, Feb 25, 2010 at 11:22 AM, Rick Dwyer wrote:
> OK... external function... that would explain why I could not locate it.
>
> Let me get right to the problem I am having with this code as someone may=
be
> able to help directly.
>
> I have a link on a page that opens a contact form. Â The link is
> mypage.php?my_id=3D5
>
> So on mypage.php, I capture this value with:
> $my_id=3D$_GET['my_id'];
>
> I understand this much. Â But when the end user submits this contact =
form
> they do so to formcheck.php and if formcheck.php sees a required field is
> blank, it throws it back to mypage.php with an alert. Â BUT, I lose t=
he value
> of the variable $my_id. Â SO, I created a hidden field on mypate.php =
with
> Â value=3D"" and on formcheck.php, I added $my_i=
d =3D
> $_Post['my_id'];
>
> However, when formcheck.php returns me to mypage.php, $my_id is still bla=
nk.
>
> Very frustrating.
>
> Any help determining what I am doing wrong is greatly appreciated.
>
> Thanks.
>
>
>
> Â --Rick
>
>
> On Feb 25, 2010, at 12:31 AM, Paul M Foster wrote:
>
>> On Thu, Feb 25, 2010 at 12:16:08AM -0500, Robert Cummings wrote:
>>
>>> Rick Dwyer wrote:
>>>>
>>>> Hello all.
>>>>
>>>> I'm trying to learn PHP on the fly and I have a line of code that
>>>> contains syntax I can't find documented anywhere:
>>>>
>>>> php echo check('element8');
>>>>
>>>> In the above line, can someone tell me what "check" means?
>>>
>>>
>>> In the above, check is a function. It is being called with parameter
>>> 'element8'.
>>
>> This is true. But perhaps more importantly, check() is not a native PHP
>> function. Thus it comes from some other library or group of external
>> functions.
>>
>> Paul
>>
>> --
>> Paul M. Foster
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--=20
~viraj
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 07:04:12 von James Mclean
On Thu, Feb 25, 2010 at 4:22 PM, Rick Dwyer wrote:
> OK... external function... that would explain why I could not locate it.
>
> Let me get right to the problem I am having with this code as someone may=
be
> able to help directly.
>
> I have a link on a page that opens a contact form. =A0The link is
> mypage.php?my_id=3D5
>
> So on mypage.php, I capture this value with:
> $my_id=3D$_GET['my_id'];
>
> I understand this much. =A0But when the end user submits this contact for=
m
> they do so to formcheck.php and if formcheck.php sees a required field is
> blank, it throws it back to mypage.php with an alert. =A0BUT, I lose the =
value
> of the variable $my_id. =A0SO, I created a hidden field on mypate.php wit=
h
> =A0value=3D"" and on formcheck.php, I added $my_id =
=3D
> $_Post['my_id'];
>
> However, when formcheck.php returns me to mypage.php, $my_id is still bla=
nk.
Use the right varialble for the method you're using, so if you're
posting, use $_POST, if you're getting use $_GET..
Going by your example, $_GET is what you should probably be using,
this is usually the default method if no method is specified on the
form tag.
Cheers
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Syntax Help - Check?
am 25.02.2010 07:29:39 von Rick Dwyer
Hmm. OK with the help below, I am closer.
The other fields on the page are getting passed via form fields that
look like this:
input type="text" value=""
name="form[element9]" size="40" maxlength="255"
so I added:
input type="text" value=""
name="form[my_id]" size="40" maxlength="255"
and formcheck.php has:
//start the session
session_start();
//array of fields in form. (In the format "field_name" => "field_label")
$form_fields = array(
"element0" => 'Your Name:',
"element1" => 'Your Email:',
"element4" => 'Item Number:',
......
);
and I added:
"my_id" => 'My ID Is:',
And this works!
So when I am on mypage.php and I enter a value into the form field
"my_id" it carries over and repopulates should the form fail validation.
But upon initial load of the page from my link of mypage.php?my_id=5
(so I am not getting there via a form submit) how do I get the value
into the form field?
--Rick
On Feb 25, 2010, at 1:02 AM, viraj wrote:
> if you do the redirection with header('Location: /mypage.php'),
> setting a variable on formcheck.php is not enough.
>
> if you modify the header('Location: /mypage.php') to..
>
> header('Location: /mypage.php?my_id=5')
>
> it will take the variable to mypage.php as $_GET['my_id]
>
> you can not expect a variable value set in to $_POST array to reflect
> on a totally different page without making it a form post (aka use of
> proper headers).
>
> i guess, it's time to you to read about session_start() method and the
> array $_SESSION available in php :)
>
>
> ~viraj
>
> On Thu, Feb 25, 2010 at 11:22 AM, Rick Dwyer
> wrote:
>> OK... external function... that would explain why I could not
>> locate it.
>>
>> Let me get right to the problem I am having with this code as
>> someone may be
>> able to help directly.
>>
>> I have a link on a page that opens a contact form. The link is
>> mypage.php?my_id=5
>>
>> So on mypage.php, I capture this value with:
>> $my_id=$_GET['my_id'];
>>
>> I understand this much. But when the end user submits this contact
>> form
>> they do so to formcheck.php and if formcheck.php sees a required
>> field is
>> blank, it throws it back to mypage.php with an alert. BUT, I lose
>> the value
>> of the variable $my_id. SO, I created a hidden field on mypate.php
>> with
>> value="" and on formcheck.php, I added $my_id =
>> $_Post['my_id'];
>>
>> However, when formcheck.php returns me to mypage.php, $my_id is
>> still blank.
>>
>> Very frustrating.
>>
>> Any help determining what I am doing wrong is greatly appreciated.
>>
>> Thanks.
>>
>>
>>
>> --Rick
>>
>>
>> On Feb 25, 2010, at 12:31 AM, Paul M Foster wrote:
>>
>>> On Thu, Feb 25, 2010 at 12:16:08AM -0500, Robert Cummings wrote:
>>>
>>>> Rick Dwyer wrote:
>>>>>
>>>>> Hello all.
>>>>>
>>>>> I'm trying to learn PHP on the fly and I have a line of code that
>>>>> contains syntax I can't find documented anywhere:
>>>>>
>>>>> php echo check('element8');
>>>>>
>>>>> In the above line, can someone tell me what "check" means?
>>>>
>>>>
>>>> In the above, check is a function. It is being called with
>>>> parameter
>>>> 'element8'.
>>>
>>> This is true. But perhaps more importantly, check() is not a
>>> native PHP
>>> function. Thus it comes from some other library or group of external
>>> functions.
>>>
>>> Paul
>>>
>>> --
>>> Paul M. Foster
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> ~viraj
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php