Re: [PHP] resubmit form after validation error

2009-06-23 Thread Shawn McKenzie
PJ wrote:
> Shawn McKenzie wrote:
>> PJ wrote:
>>   
>>> Caner Bulut wrote:
>>> 
 Hi PJ,

 You can use the structure following

 $bid = htmlentities($_GET['id']);

   
>>> the code below
>>> 
 if(empty($bid) {
 $bid=0;
 }
   
>>> produces an empty screen with no error messages...
>>> I have been having some trouble understanding "empty()" -- it doesn't
>>> seem to want to work for me in any situation
>>> 
>> YOU, always need to have error_reporting on and display errors on, and
>> also be logging errors so that you can see parse errors in the log.
>> Always check the log after a "empty screen".  I've seen many posts from
>> you where you get a blank, empty, white screen.  This is most always a
>> parse error!.  Get an editor that will show you bad syntax like the
>> above.  It is a freaking parse error because you don't have matched
>> parentheses!
>>
>>   
> Shawn, I always have error_reporting on and display errors on.
> Ok, I didn't see the error above; but in my defense (no defense really),
> I should have thought about it) i just copied the code I was given.
> Dumb, dumb, dumb. Thanks for pointing it out.
> And yes, I do have a lot of problems with curly braces & parentheses.
> I eventually do find them... but...
> I have been thinking about what editor would show me bad syntax...
> I've been using HOMESITE+ for no other reason than that it allows me to
> switch between files quickly ... I do have Netbeans, but it screwed me
> once when I accidentally closed it and I lost the whole file and had to
> redo it all, so I'm a bit wary...
> And I'm not too keen on getting into some IDE... tried them and found
> them cumbersome to set up & learn.
> Any suggestions?
> 

If you are on Winbloze, I thing the free notepad++ has syntax
highlighting for PHP.

-- 
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] resubmit form after validation error

2009-06-23 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>   
>> Caner Bulut wrote:
>> 
>>> Hi PJ,
>>>
>>> You can use the structure following
>>>
>>> $bid = htmlentities($_GET['id']);
>>>
>>>   
>> the code below
>> 
>>> if(empty($bid) {
>>> $bid=0;
>>> }
>>>   
>> produces an empty screen with no error messages...
>> I have been having some trouble understanding "empty()" -- it doesn't
>> seem to want to work for me in any situation
>> 
>
> YOU, always need to have error_reporting on and display errors on, and
> also be logging errors so that you can see parse errors in the log.
> Always check the log after a "empty screen".  I've seen many posts from
> you where you get a blank, empty, white screen.  This is most always a
> parse error!.  Get an editor that will show you bad syntax like the
> above.  It is a freaking parse error because you don't have matched
> parentheses!
>
>   
Shawn, I always have error_reporting on and display errors on.
Ok, I didn't see the error above; but in my defense (no defense really),
I should have thought about it) i just copied the code I was given.
Dumb, dumb, dumb. Thanks for pointing it out.
And yes, I do have a lot of problems with curly braces & parentheses.
I eventually do find them... but...
I have been thinking about what editor would show me bad syntax...
I've been using HOMESITE+ for no other reason than that it allows me to
switch between files quickly ... I do have Netbeans, but it screwed me
once when I accidentally closed it and I lost the whole file and had to
redo it all, so I'm a bit wary...
And I'm not too keen on getting into some IDE... tried them and found
them cumbersome to set up & learn.
Any suggestions?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] resubmit form after validation error

2009-06-23 Thread Andrew Ballard
On Tue, Jun 23, 2009 at 11:37 AM, Shawn McKenzie wrote:
> PJ wrote:
>> Caner Bulut wrote:
>>> Hi PJ,
>>>
>>> You can use the structure following
>>>
>>> $bid = htmlentities($_GET['id']);
>>>
>> the code below
>>> if(empty($bid) {
>>> $bid=0;
>>> }
>> produces an empty screen with no error messages...
>> I have been having some trouble understanding "empty()" -- it doesn't
>> seem to want to work for me in any situation
>
> YOU, always need to have error_reporting on and display errors on, and
> also be logging errors so that you can see parse errors in the log.
> Always check the log after a "empty screen".  I've seen many posts from
> you where you get a blank, empty, white screen.  This is most always a
> parse error!.  Get an editor that will show you bad syntax like the
> above.  It is a freaking parse error because you don't have matched
> parentheses!
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>

You mean when PHP parses my code, it can't just tell what I meant and
do it? I mean, web browsers aren't that picky. Geesh! :-P

Andrew

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



Re: [PHP] resubmit form after validation error

2009-06-23 Thread Shawn McKenzie
PJ wrote:
> Caner Bulut wrote:
>> Hi PJ,
>>
>> You can use the structure following
>>
>> $bid = htmlentities($_GET['id']);
>>
> the code below
>> if(empty($bid) {
>> $bid=0;
>> }
> produces an empty screen with no error messages...
> I have been having some trouble understanding "empty()" -- it doesn't
> seem to want to work for me in any situation

YOU, always need to have error_reporting on and display errors on, and
also be logging errors so that you can see parse errors in the log.
Always check the log after a "empty screen".  I've seen many posts from
you where you get a blank, empty, white screen.  This is most always a
parse error!.  Get an editor that will show you bad syntax like the
above.  It is a freaking parse error because you don't have matched
parentheses!

-- 
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] resubmit form after validation error

2009-06-23 Thread PJ
Caner Bulut wrote:
> Hi PJ,
>
> You can use the structure following
>
> $bid = htmlentities($_GET['id']);
>
the code below
> if(empty($bid) {
> $bid=0;
> }
produces an empty screen with no error messages...
I have been having some trouble understanding "empty()" -- it doesn't
seem to want to work for me in any situation

Anyway, I seem to have it all working, pretty much. Still testing...
I think the problem had to do with either sessions, or setting the right
parameters for the submit option or using action="" -- the latter seems to work ok. Although, it is
interesting that it is possible to use another file for the action - but
that seems a bit redundant as you have to populate that file with almost
the same stuff that is in the original form file...
I'm making progress, but I don't think I'm learning a lot other than to
contain my frustration. ;-)
>
>
> if(is_numeric($bid)) {
>
> if($bid==0) {
> do something
> } else if($bid==1) {
> do something
> }
>
> }
>
> After this code there will always a number, If the id variable is 0, bid
> will be 0 and you can control it.
>
> Thanks.
> Caner.
>
> 2009/6/22 PJ 
>
>> Hi Caner,
>> Thanks for the input. I'm not sure that would do it as the first
>> instruction on the page is :
>> $bid = $_GET['id'] ;
>>
>> thus, the page cannot even be loaded if there is no id in the uri - it
>> generates a number of errors.
>> In order to use the feature of editing, I use a search page and then set
>> up an href to the edit page with the id of the item to be edited.
>> I finally figured out to do the action="another_page.php" and with
>> slight modifications to the form, things finally work.
>> And, to delete the item (all records related to the item), I set up 2
>> submits - 1 to "update.php" and one to "delete.php"
>> Maybe it's all cumbersome and maybe it is possible to streamline the
>> whole process, but then it does work and I am just learning... :-)
>> Thanks again.
>> PJ
>>
>>
>>
>> Caner BULUT wrote:
>>> Hi,
>>>
>>> You can use a variable to that. Like following. Example if the variable
>> is 1
>>> you start to processing form input.
>>>
>>> Example
>>>
>>> >> }
>>>
>>> Thanks.
>>> Caner.
>>>
>>>
>>> -Original Message-
>>> From: PJ [mailto:af.gour...@videotron.ca]
>>> Sent: 20 June 2009 22:55
>>> To: php-general@lists.php.net
>>> Subject: [PHP] resubmit form after validation error
>>>
>>> I'm having a bit of a time figuring out how to resubmit a form after
>>> obligatory field missing error.
>>> The problem is that the page is accessed from a search page href where
>>> the uri is like = file.php$=123.
>>> Since the method="post" action="file.php?= does
>>> not work nor does PHP_SELF, I have set the action="otherfile.php". All
>>> is well, if all fields are properly entered, but if there is an error,
>>> how to resubmit the form for correction and resubmission without using
>>> js or functions or redoing it all from scratch?
>>>
>>>
>>
>> --
>> Herv� Kempf: "Pour sauver la plan�te, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>> http://www.ptahhotep.com
>> http://www.chiccantine.com/andypantry.php
>>
>>
>


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php

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



Re: [PHP] resubmit form after validation error

2009-06-22 Thread Caner Bulut
Hi PJ,

You can use the structure following

$bid = htmlentities($_GET['id']);

if(empty($bid) {
 $bid=0;
}


if(is_numeric($bid)) {

if($bid==0) {
do something
} else if($bid==1) {
do something
}

}

After this code there will always a number, If the id variable is 0, bid
will be 0 and you can control it.

Thanks.
Caner.

2009/6/22 PJ 

> Hi Caner,
> Thanks for the input. I'm not sure that would do it as the first
> instruction on the page is :
> $bid = $_GET['id'] ;
>
> thus, the page cannot even be loaded if there is no id in the uri - it
> generates a number of errors.
> In order to use the feature of editing, I use a search page and then set
> up an href to the edit page with the id of the item to be edited.
> I finally figured out to do the action="another_page.php" and with
> slight modifications to the form, things finally work.
> And, to delete the item (all records related to the item), I set up 2
> submits - 1 to "update.php" and one to "delete.php"
> Maybe it's all cumbersome and maybe it is possible to streamline the
> whole process, but then it does work and I am just learning... :-)
> Thanks again.
> PJ
>
>
>
> Caner BULUT wrote:
> > Hi,
> >
> > You can use a variable to that. Like following. Example if the variable
> is 1
> > you start to processing form input.
> >
> > Example
> >
> >  > }
> >
> > Thanks.
> > Caner.
> >
> >
> > -Original Message-
> > From: PJ [mailto:af.gour...@videotron.ca]
> > Sent: 20 June 2009 22:55
> > To: php-general@lists.php.net
> > Subject: [PHP] resubmit form after validation error
> >
> > I'm having a bit of a time figuring out how to resubmit a form after
> > obligatory field missing error.
> > The problem is that the page is accessed from a search page href where
> > the uri is like = file.php$=123.
> > Since the method="post" action="file.php?= does
> > not work nor does PHP_SELF, I have set the action="otherfile.php". All
> > is well, if all fields are properly entered, but if there is an error,
> > how to resubmit the form for correction and resubmission without using
> > js or functions or redoing it all from scratch?
> >
> >
>
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>


Re: [PHP] resubmit form after validation error

2009-06-22 Thread PJ
Hi Caner,
Thanks for the input. I'm not sure that would do it as the first
instruction on the page is :
$bid = $_GET['id'] ;

thus, the page cannot even be loaded if there is no id in the uri - it
generates a number of errors.
In order to use the feature of editing, I use a search page and then set
up an href to the edit page with the id of the item to be edited.
I finally figured out to do the action="another_page.php" and with
slight modifications to the form, things finally work.
And, to delete the item (all records related to the item), I set up 2
submits - 1 to "update.php" and one to "delete.php"
Maybe it's all cumbersome and maybe it is possible to streamline the
whole process, but then it does work and I am just learning... :-)
Thanks again.
PJ



Caner BULUT wrote:
> Hi,
>
> You can use a variable to that. Like following. Example if the variable is 1
> you start to processing form input.
>
> Example 
>
>  }
>
> Thanks.
> Caner.
>
>
> -Original Message-
> From: PJ [mailto:af.gour...@videotron.ca] 
> Sent: 20 June 2009 22:55
> To: php-general@lists.php.net
> Subject: [PHP] resubmit form after validation error
>
> I'm having a bit of a time figuring out how to resubmit a form after
> obligatory field missing error.
> The problem is that the page is accessed from a search page href where
> the uri is like = file.php$=123.
> Since the method="post" action="file.php?= does
> not work nor does PHP_SELF, I have set the action="otherfile.php". All
> is well, if all fields are properly entered, but if there is an error,
> how to resubmit the form for correction and resubmission without using
> js or functions or redoing it all from scratch?
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



RE: [PHP] resubmit form after validation error

2009-06-20 Thread Caner BULUT
Hi,

You can use a variable to that. Like following. Example if the variable is 1
you start to processing form input.

Example 

mailto:af.gour...@videotron.ca] 
Sent: 20 June 2009 22:55
To: php-general@lists.php.net
Subject: [PHP] resubmit form after validation error

I'm having a bit of a time figuring out how to resubmit a form after
obligatory field missing error.
The problem is that the page is accessed from a search page href where
the uri is like = file.php$=123.
Since the method="post" action="file.php?= does
not work nor does PHP_SELF, I have set the action="otherfile.php". All
is well, if all fields are properly entered, but if there is an error,
how to resubmit the form for correction and resubmission without using
js or functions or redoing it all from scratch?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
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