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 <af.gour...@videotron.ca>

> 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
> >
> > <form method="post" action="file.php?action=1>
> >
> > And in file.php you check the action variable if it is 1 you can start
> the
> > processing data.
> >
> > If($_GET['action']==1) {
> >  Echo "done";
> > }
> >
> > 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?=<?php echo $number; ?> 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
>
>

Reply via email to