Re: [PHP] Is there a "GoTo Page" Function?
Not without seeing some html code. If you haven't altered any of the other font/color settings I'd have thought they'd all be the same color, black. Look up some info on 'Cascaded Style Sheets',... then it'd be as simple as and all of the text/alignment, etc,.. takes the settings of whatever is defined in "blue". Jim. "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks Jim, > > Now that looks better. > > New problem: in one of the almost identical tables I've used it in, the title > for each row is in black and not the color that the page text is set for. The > other table is correctly set. Any idea what would cause the discrepancy? > > Tia, > Andre > > > On Wednesday 06 March 2002 00:43, you wrote: > > Whack your text and input boxes in different cells of a table,.. use align > > (or nowadays an appropriate style setting) and that should get your things > > lined up :-) > > > > "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > Hugh, > > > > > > Food? What's that? > > > > > > [Btw, my wife would love you. She seems to think I spend too much time in > > > here . . .] > > > > > > Thanks for the help. I sort of figured I'd have to make a php page to > > > call the error codes, then call another for the actual database stuff. At > > > > least, > > > > > I'll be able to find my errors quicker. Later, when I understand things a > > > > bit > > > > > better, I'll clean up that mess! [I've actualy got three forms working > > > > now -- > > > > > I'm amazed!] > > > > > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > > > with those horrible "nbsp" and since the text name before it varies . . . > > > sigh . . . someday I'll figure that out! > > > > > > Regards, > > > Andre > > > > > > On Tuesday 05 March 2002 23:51, you wrote: > > > > Andre, > > > > Yes, the html page with your input form effectively ends with the > > > > > > > > > > tag so any decision statements on that page past that tag would miss > > > > the form input. So, put any decision statements on the php page where > > > > you've > > > > > > put your database code. I'm sure someone will educate me on the above > > > > statements, and I'll likely deserve it. When you eventually use the > > > > $php_self call, you can put everything on one page above the form > > > > start. > > > > > > > > You can have as many calls on an html page as is needed to > > > > complete your tasks. However, I use php to do some rather complex math > > > > (it's complex to me at least), so I got in the habit of using php > > > > throughout a page without breaking out for html. For me it is more > > > > readable. > > > > > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it > > > > got > > > > > > me off the ground. The online manuals for php and mysql have also been > > > > invaluable. Save your money, buy food instead. > > > > > > > > Hope this helps, > > > > Hugh > > > > - Original Message - > > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > > To: "hugh danaher" <[EMAIL PROTECTED]> > > > > Sent: Tuesday, March 05, 2002 6:35 PM > > > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > > > > > Hi Hugh, > > > > > > > > > > Well, actually my next question you've sort of answered: "Where do I > > > > put > > > > > > this > > > > > > > > > code?" With all the new information coming at me, I haven't had time > > > > to > > > > > > think > > > > > > > > > it through -- but I gather from your response, the answer would be: > > > > 'Put > > > > > > it > > > > > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > > > > > One other question: I gather it's OK to have multiple i
RE: [PHP] Is there a "GoTo Page" Function?
> > My wife knows I spend too much time in here. > What's a wife? // Wife class class Wife extends Human () { // Constructor function Wife () { if ($developer->priorities[0] == "usenet") die ("Can't create wife: must be higher priority than usenet"); } } HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
Thanks Jim, Now that looks better. New problem: in one of the almost identical tables I've used it in, the title for each row is in black and not the color that the page text is set for. The other table is correctly set. Any idea what would cause the discrepancy? Tia, Andre On Wednesday 06 March 2002 00:43, you wrote: > Whack your text and input boxes in different cells of a table,.. use align > (or nowadays an appropriate style setting) and that should get your things > lined up :-) > > "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hugh, > > > > Food? What's that? > > > > [Btw, my wife would love you. She seems to think I spend too much time in > > here . . .] > > > > Thanks for the help. I sort of figured I'd have to make a php page to > > call the error codes, then call another for the actual database stuff. At > > least, > > > I'll be able to find my errors quicker. Later, when I understand things a > > bit > > > better, I'll clean up that mess! [I've actualy got three forms working > > now -- > > > I'm amazed!] > > > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > > with those horrible "nbsp" and since the text name before it varies . . . > > sigh . . . someday I'll figure that out! > > > > Regards, > > Andre > > > > On Tuesday 05 March 2002 23:51, you wrote: > > > Andre, > > > Yes, the html page with your input form effectively ends with the > > > > > > tag so any decision statements on that page past that tag would miss > > > the form input. So, put any decision statements on the php page where > > you've > > > > put your database code. I'm sure someone will educate me on the above > > > statements, and I'll likely deserve it. When you eventually use the > > > $php_self call, you can put everything on one page above the form > > > start. > > > > > > You can have as many calls on an html page as is needed to > > > complete your tasks. However, I use php to do some rather complex math > > > (it's complex to me at least), so I got in the habit of using php > > > throughout a page without breaking out for html. For me it is more > > > readable. > > > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it > > got > > > > me off the ground. The online manuals for php and mysql have also been > > > invaluable. Save your money, buy food instead. > > > > > > Hope this helps, > > > Hugh > > > - Original Message - > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > To: "hugh danaher" <[EMAIL PROTECTED]> > > > Sent: Tuesday, March 05, 2002 6:35 PM > > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > > > Hi Hugh, > > > > > > > > Well, actually my next question you've sort of answered: "Where do I > > put > > > > this > > > > > > > code?" With all the new information coming at me, I haven't had time > > to > > > > think > > > > > > > it through -- but I gather from your response, the answer would be: > > 'Put > > > > it > > > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > > > One other question: I gather it's OK to have multiple instances of > > > > > > > > > > > > ?> on the same html page or in the same php page? > > > > > > > > I realize that these are pretty fundamental questions. As soon as I > > can > > > > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. > > In > > > > the > > > > > > > meantime, I would greatly appreciate it if you could clear up these > > basic > > > > > assumptions for me. > > > > > > > > Thanks for your help! > > > > Tia, > > > > Andre > > > > > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > > Andre, > > > > > My note on decision lines was in anticipation of your next > > > > > > question/problem > > > > > > > > of "How do I handle things if the user doesn't fill in his name, &
Re: [PHP] Is there a "GoTo Page" Function?
On Tuesday, March 5, 2002, at 07:56 PM, Andre Dubuc wrote: > And thanks again! > I like the 'function print_name_form()' -- I gather you could do this > for all > the NOT NULL variables that a form requires. Further, would you just > change > the "print_name" to 'print_whatever-other-variable' that I would want to > check? Is there another way to consolidate the code at this point? Or > would I > just duplicate the code for each not-null variable? You can name a function whatever you want -- they're arbitrary, user-defined puppies. HOWEVER, the contents of a function need to do what you want -- the function that I showed you creates a very specific input, named "name" or something like that. So for each other input you want to create within a function, you'd have to make sure that they created unique inputs. Personally, I put all of my inputs into one function, and the function itself does both the error checking and the form-printing. This is probably not the cleanest way to do it, but it works -- in this case, the function is more of a subroutine than a proper function. (Subroutines and functions are more or less the same thing in PHP, there's no syntactic difference.) > [Btw, I sometimes long for the old Paradox PAL code that seemed so > difficult > at the time I learnt it -- PHP is very similar, but the syntax seems so > much > more compact.] If you get to a point where you feel comfortable with PHP, you might consider investigating the Python language. It's got a very different feel, for instance you don't use bucks to indicate variable names, and there are braces around function definitions or if statements. Rather, you use whitespace to keep code chunks organized. Some people believe this is a more organized way to write code. Python is probably more apt for writing standalone programs and scripts, whereas PHP is more apt for writing web applications, but that's an opinion of mine and you can really use either language for either of those. www.python.org for more info. > While we're on the topic of fields ('input type=text") is there anyway > to > include a non-printing space in the data entry, say for 'Name", that > would > not be passed to the database? Thus, on the screen it would appear: > > Name: [non-printing space]Andre but in the database entry: > Name:Andre > > This isn't a pressing question, and probably is a formatting question, > but I > wonder if it's possible? Yes, a formatting/HTML question. I learned everything I needed to know about HTML from Sams Teach Yourself HTML/XHTML in 24 hours or from the web itself. That book was also super super easy. I'd say a little bit too easy if you're already learning things like PHP, which are a more advanced topic. I am not a very good designer, so I can't really answer your question directly, but I find that forms lend themselves well to being placed within HTML's tables. Name: Password: Favorite Sushi Ebi Tako California "; ?> But when you see this in a web page, it is nicely formatted. Don't forget to customize the way the table looks by declaring borders and cell spacing in a style sheet. Also, as an exercise, come up with a clever way to put this code into a function. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
On Wednesday, March 6, 2002, at 01:10 AM, hugh danaher wrote: > My wife knows I spend too much time in here. What's a wife? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
My wife knows I spend too much time in here. - Original Message - From: "Andre Dubuc" <[EMAIL PROTECTED]> To: "hugh danaher" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, March 05, 2002 9:40 PM Subject: Re: [PHP] Is there a "GoTo Page" Function? > Hugh, > > Food? What's that? > > [Btw, my wife would love you. She seems to think I spend too much time in > here . . .] > > Thanks for the help. I sort of figured I'd have to make a php page to call > the error codes, then call another for the actual database stuff. At least, > I'll be able to find my errors quicker. Later, when I understand things a bit > better, I'll clean up that mess! [I've actualy got three forms working now -- > I'm amazed!] > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > with those horrible "nbsp" and since the text name before it varies . . . > sigh . . . someday I'll figure that out! > > Regards, > Andre > > > > On Tuesday 05 March 2002 23:51, you wrote: > > Andre, > > Yes, the html page with your input form effectively ends with the > > tag so any decision statements on that page past that tag would miss the > > form input. So, put any decision statements on the php page where you've > > put your database code. I'm sure someone will educate me on the above > > statements, and I'll likely deserve it. When you eventually use the > > $php_self call, you can put everything on one page above the form start. > > > > You can have as many calls on an html page as is needed to > > complete your tasks. However, I use php to do some rather complex math > > (it's complex to me at least), so I got in the habit of using php > > throughout a page without breaking out for html. For me it is more > > readable. > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it got > > me off the ground. The online manuals for php and mysql have also been > > invaluable. Save your money, buy food instead. > > > > Hope this helps, > > Hugh > > - Original Message - > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > To: "hugh danaher" <[EMAIL PROTECTED]> > > Sent: Tuesday, March 05, 2002 6:35 PM > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > Hi Hugh, > > > > > > Well, actually my next question you've sort of answered: "Where do I put > > > > this > > > > > code?" With all the new information coming at me, I haven't had time to > > > > think > > > > > it through -- but I gather from your response, the answer would be: 'Put > > > > it > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > One other question: I gather it's OK to have multiple instances of > > > > > > > > ?> on the same html page or in the same php page? > > > > > > I realize that these are pretty fundamental questions. As soon as I can > > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. In > > > > the > > > > > meantime, I would greatly appreciate it if you could clear up these basic > > > assumptions for me. > > > > > > Thanks for your help! > > > Tia, > > > Andre > > > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > Andre, > > > > My note on decision lines was in anticipation of your next > > > > question/problem > > > > > > of "How do I handle things if the user doesn't fill in his name, > > > > address, > > > > > > whatever?" My solution is check to see if the cell is filled and if > > > > not then quit the database storage and tell the person to fill in the > > > > info. > > > > I > > > > > > first check to see if the data is set and if not, send a message. This > > > > would come before wasting your time storing anything. There are many > > > > other > > > > > > methods to check user input but I learned the if (!isset($something)) > > > > die() > > > > > > method first, and to me it's the most straight forward. > > > > Hope this helps, > > > > Hugh > > > > - Original Message - > > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > &
Re: [PHP] Is there a "GoTo Page" Function?
Whack your text and input boxes in different cells of a table,.. use align (or nowadays an appropriate style setting) and that should get your things lined up :-) "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED].; > Hugh, > > Food? What's that? > > [Btw, my wife would love you. She seems to think I spend too much time in > here . . .] > > Thanks for the help. I sort of figured I'd have to make a php page to call > the error codes, then call another for the actual database stuff. At least, > I'll be able to find my errors quicker. Later, when I understand things a bit > better, I'll clean up that mess! [I've actualy got three forms working now -- > I'm amazed!] > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > with those horrible "nbsp" and since the text name before it varies . . . > sigh . . . someday I'll figure that out! > > Regards, > Andre > > > > On Tuesday 05 March 2002 23:51, you wrote: > > Andre, > > Yes, the html page with your input form effectively ends with the > > tag so any decision statements on that page past that tag would miss the > > form input. So, put any decision statements on the php page where you've > > put your database code. I'm sure someone will educate me on the above > > statements, and I'll likely deserve it. When you eventually use the > > $php_self call, you can put everything on one page above the form start. > > > > You can have as many calls on an html page as is needed to > > complete your tasks. However, I use php to do some rather complex math > > (it's complex to me at least), so I got in the habit of using php > > throughout a page without breaking out for html. For me it is more > > readable. > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it got > > me off the ground. The online manuals for php and mysql have also been > > invaluable. Save your money, buy food instead. > > > > Hope this helps, > > Hugh > > - Original Message - > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > To: "hugh danaher" <[EMAIL PROTECTED]> > > Sent: Tuesday, March 05, 2002 6:35 PM > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > Hi Hugh, > > > > > > Well, actually my next question you've sort of answered: "Where do I put > > > > this > > > > > code?" With all the new information coming at me, I haven't had time to > > > > think > > > > > it through -- but I gather from your response, the answer would be: 'Put > > > > it > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > One other question: I gather it's OK to have multiple instances of > > > > > > > > ?> on the same html page or in the same php page? > > > > > > I realize that these are pretty fundamental questions. As soon as I can > > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. In > > > > the > > > > > meantime, I would greatly appreciate it if you could clear up these basic > > > assumptions for me. > > > > > > Thanks for your help! > > > Tia, > > > Andre > > > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > Andre, > > > > My note on decision lines was in anticipation of your next > > > > question/problem > > > > > > of "How do I handle things if the user doesn't fill in his name, > > > > address, > > > > > > whatever?" My solution is check to see if the cell is filled and if > > > > not then quit the database storage and tell the person to fill in the > > > > info. > > > > I > > > > > > first check to see if the data is set and if not, send a message. This > > > > would come before wasting your time storing anything. There are many > > > > other > > > > > > methods to check user input but I learned the if (!isset($something)) > > > > die() > > > > > > method first, and to me it's the most straight forward. > > > > Hope this helps, > > > > Hugh > > > > - Original Message - > > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > > To: "Erik Price" <[EMAIL PROTECT
Re: [PHP] Is there a "GoTo Page" Function?
Hugh, Food? What's that? [Btw, my wife would love you. She seems to think I spend too much time in here . . .] Thanks for the help. I sort of figured I'd have to make a php page to call the error codes, then call another for the actual database stuff. At least, I'll be able to find my errors quicker. Later, when I understand things a bit better, I'll clean up that mess! [I've actualy got three forms working now -- I'm amazed!] Gosh, the output is ugly, though! I can't seem to line up the input boxes with those horrible "nbsp" and since the text name before it varies . . . sigh . . . someday I'll figure that out! Regards, Andre On Tuesday 05 March 2002 23:51, you wrote: > Andre, > Yes, the html page with your input form effectively ends with the > tag so any decision statements on that page past that tag would miss the > form input. So, put any decision statements on the php page where you've > put your database code. I'm sure someone will educate me on the above > statements, and I'll likely deserve it. When you eventually use the > $php_self call, you can put everything on one page above the form start. > > You can have as many calls on an html page as is needed to > complete your tasks. However, I use php to do some rather complex math > (it's complex to me at least), so I got in the habit of using php > throughout a page without breaking out for html. For me it is more > readable. > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it got > me off the ground. The online manuals for php and mysql have also been > invaluable. Save your money, buy food instead. > > Hope this helps, > Hugh > - Original Message - > From: "Andre Dubuc" <[EMAIL PROTECTED]> > To: "hugh danaher" <[EMAIL PROTECTED]> > Sent: Tuesday, March 05, 2002 6:35 PM > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > Hi Hugh, > > > > Well, actually my next question you've sort of answered: "Where do I put > > this > > > code?" With all the new information coming at me, I haven't had time to > > think > > > it through -- but I gather from your response, the answer would be: 'Put > > it > > > before the database code rather than in the html page.' Am I correct? > > > > One other question: I gather it's OK to have multiple instances of > > > > ?> on the same html page or in the same php page? > > > > I realize that these are pretty fundamental questions. As soon as I can > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. In > > the > > > meantime, I would greatly appreciate it if you could clear up these basic > > assumptions for me. > > > > Thanks for your help! > > Tia, > > Andre > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > Andre, > > > My note on decision lines was in anticipation of your next > > question/problem > > > > of "How do I handle things if the user doesn't fill in his name, > > address, > > > > whatever?" My solution is check to see if the cell is filled and if > > > not then quit the database storage and tell the person to fill in the > > > info. > > I > > > > first check to see if the data is set and if not, send a message. This > > > would come before wasting your time storing anything. There are many > > other > > > > methods to check user input but I learned the if (!isset($something)) > > die() > > > > method first, and to me it's the most straight forward. > > > Hope this helps, > > > Hugh > > > - Original Message - > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > To: "Erik Price" <[EMAIL PROTECTED]> > > > Cc: <[EMAIL PROTECTED]> > > > Sent: Tuesday, March 05, 2002 4:56 PM > > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > > > On Tuesday 05 March 2002 19:20, you wrote: > > > > > On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > > > > > Now that makes sense. I'm getting a better idea of how it works > > > > > > together. I > > > > > > figured there must be a way to control the "Submit" button's > > > > > > behaviour, > > > > > > > > > but I > > > > > > didn't know where to look. > > > > > > > > > > Yep, the submit
Re: [PHP] Is there a "GoTo Page" Function?
Andre, Yes, the html page with your input form effectively ends with the tag so any decision statements on that page past that tag would miss the form input. So, put any decision statements on the php page where you've put your database code. I'm sure someone will educate me on the above statements, and I'll likely deserve it. When you eventually use the $php_self call, you can put everything on one page above the form start. You can have as many calls on an html page as is needed to complete your tasks. However, I use php to do some rather complex math (it's complex to me at least), so I got in the habit of using php throughout a page without breaking out for html. For me it is more readable. My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it got me off the ground. The online manuals for php and mysql have also been invaluable. Save your money, buy food instead. Hope this helps, Hugh - Original Message - From: "Andre Dubuc" <[EMAIL PROTECTED]> To: "hugh danaher" <[EMAIL PROTECTED]> Sent: Tuesday, March 05, 2002 6:35 PM Subject: Re: [PHP] Is there a "GoTo Page" Function? > Hi Hugh, > > Well, actually my next question you've sort of answered: "Where do I put this > code?" With all the new information coming at me, I haven't had time to think > it through -- but I gather from your response, the answer would be: 'Put it > before the database code rather than in the html page.' Am I correct? > > One other question: I gather it's OK to have multiple instances of ?> on the same html page or in the same php page? > > I realize that these are pretty fundamental questions. As soon as I can > scrape up eighty dollars I'll buy a book on PHP and another on HTML. In the > meantime, I would greatly appreciate it if you could clear up these basic > assumptions for me. > > Thanks for your help! > Tia, > Andre > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > > Andre, > > My note on decision lines was in anticipation of your next question/problem > > of "How do I handle things if the user doesn't fill in his name, address, > > whatever?" My solution is check to see if the cell is filled and if not > > then quit the database storage and tell the person to fill in the info. I > > first check to see if the data is set and if not, send a message. This > > would come before wasting your time storing anything. There are many other > > methods to check user input but I learned the if (!isset($something)) die() > > method first, and to me it's the most straight forward. > > Hope this helps, > > Hugh > > - Original Message - > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > To: "Erik Price" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Tuesday, March 05, 2002 4:56 PM > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > On Tuesday 05 March 2002 19:20, you wrote: > > > > On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > > > > Now that makes sense. I'm getting a better idea of how it works > > > > > together. I > > > > > figured there must be a way to control the "Submit" button's > > > > behaviour, > > > > > > > but I > > > > > didn't know where to look. > > > > > > > > Yep, the submit input tells the form "go do your thing", but the form > > > > already knew where to go (because you specify where to go in the > > > > 'action' attribute). The form also knows how to go -- whether it > > > > should be POST or GET. Without realizing it, you'll be learning more > > > > about the HTTP protocol itself as you start writing scripts that take > > > > advantage of its features. > > > > > > > > > Where would you insert: > > > > > > > > > > if (!isset($name)) die ("You need to fill in your name. Use the > > > > > browser's > > > > > back button and input this information."); > > > > > > > > > > I tried in the php database storage code (didn't work). Tried it > > > > > after the > > > > > appropriate 'Name' code in the form's html document. Didn't work. I > > > > know > > > > > > > that it should work somewhere . . . . > > > > > > > > > > Somehow, I don't think the "Submit" function
Re: [PHP] Is there a "GoTo Page" Function?
Andre, My note on decision lines was in anticipation of your next question/problem of "How do I handle things if the user doesn't fill in his name, address, whatever?" My solution is check to see if the cell is filled and if not then quit the database storage and tell the person to fill in the info. I first check to see if the data is set and if not, send a message. This would come before wasting your time storing anything. There are many other methods to check user input but I learned the if (!isset($something)) die() method first, and to me it's the most straight forward. Hope this helps, Hugh - Original Message - From: "Andre Dubuc" <[EMAIL PROTECTED]> To: "Erik Price" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, March 05, 2002 4:56 PM Subject: Re: [PHP] Is there a "GoTo Page" Function? > On Tuesday 05 March 2002 19:20, you wrote: > > On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > > Now that makes sense. I'm getting a better idea of how it works > > > together. I > > > figured there must be a way to control the "Submit" button's behaviour, > > > but I > > > didn't know where to look. > > > > Yep, the submit input tells the form "go do your thing", but the form > > already knew where to go (because you specify where to go in the > > 'action' attribute). The form also knows how to go -- whether it should > > be POST or GET. Without realizing it, you'll be learning more about the > > HTTP protocol itself as you start writing scripts that take advantage of > > its features. > > > > > Where would you insert: > > > > > > if (!isset($name)) die ("You need to fill in your name. Use the > > > browser's > > > back button and input this information."); > > > > > > I tried in the php database storage code (didn't work). Tried it after > > > the > > > appropriate 'Name' code in the form's html document. Didn't work. I know > > > that it should work somewhere . . . . > > > > > > Somehow, I don't think the "Submit" function is working as it should > > > (especially if a carriage return or "Enter" can override everything). Is > > > there some code that will defeat this undesirable activity? > > > > Firstly, your browser is what determines how the form is sent -- but > > usually, it's normal for the Enter key to act as the "Submit" button (a > > nice keyboard shortcut that I take advantage myself). It should not act > > in this fashion if you are typing into a textarea tag, because you might > > want to enter newlines/cr's in the textarea, but for most other form > > fields it's normal. If you want to jump from one field to the next with > > a key press, use tab. > > > > Secondly, you're wondering where to check for the presence of the data? > > How about this: > > > > > function print_name_form() > > { > > print ""; > > } > > > > if (!$_POST['name']) { > > print "You need to fill in your name."; > > print_name_form(); > > } else { > > print "Thank you!"; > > } > > ?> > > > > Why did I define a function in the beginning? Well, this way, if the > > user didn't enter a name, they don't have to hit "back" in their > > browser. The form just appears again. This is much more useful if you > > have this same function accessible from each page/script you are > > writing, so that you don't have to waste your time. Later, when you > > learn how to check for errors in your user's input (such as if the user > > entered a bunch of numbers instead of a name), this will come in handy > > so that you can save the user's legitimate values but ask them to > > re-enter their invalid values. That gets kind of technical, but it's > > one of the sweet things about functions, that they are reuseable. > > > > Erik > > > > Hi Erik, > > And thanks again! > I like the 'function print_name_form()' -- I gather you could do this for all > the NOT NULL variables that a form requires. Further, would you just change > the "print_name" to 'print_whatever-other-variable' that I would want to > check? Is there another way to consolidate the code at this point? Or would I > just duplicate the code for each not-null variable? > > [Btw, I sometimes long for the old Paradox PAL code that seeme
Re: [PHP] Is there a "GoTo Page" Function?
On Tuesday 05 March 2002 19:20, you wrote: > On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > Now that makes sense. I'm getting a better idea of how it works > > together. I > > figured there must be a way to control the "Submit" button's behaviour, > > but I > > didn't know where to look. > > Yep, the submit input tells the form "go do your thing", but the form > already knew where to go (because you specify where to go in the > 'action' attribute). The form also knows how to go -- whether it should > be POST or GET. Without realizing it, you'll be learning more about the > HTTP protocol itself as you start writing scripts that take advantage of > its features. > > > Where would you insert: > > > > if (!isset($name)) die ("You need to fill in your name. Use the > > browser's > > back button and input this information."); > > > > I tried in the php database storage code (didn't work). Tried it after > > the > > appropriate 'Name' code in the form's html document. Didn't work. I know > > that it should work somewhere . . . . > > > > Somehow, I don't think the "Submit" function is working as it should > > (especially if a carriage return or "Enter" can override everything). Is > > there some code that will defeat this undesirable activity? > > Firstly, your browser is what determines how the form is sent -- but > usually, it's normal for the Enter key to act as the "Submit" button (a > nice keyboard shortcut that I take advantage myself). It should not act > in this fashion if you are typing into a textarea tag, because you might > want to enter newlines/cr's in the textarea, but for most other form > fields it's normal. If you want to jump from one field to the next with > a key press, use tab. > > Secondly, you're wondering where to check for the presence of the data? > How about this: > > function print_name_form() > { > print ""; > } > > if (!$_POST['name']) { > print "You need to fill in your name."; > print_name_form(); > } else { > print "Thank you!"; > } > ?> > > Why did I define a function in the beginning? Well, this way, if the > user didn't enter a name, they don't have to hit "back" in their > browser. The form just appears again. This is much more useful if you > have this same function accessible from each page/script you are > writing, so that you don't have to waste your time. Later, when you > learn how to check for errors in your user's input (such as if the user > entered a bunch of numbers instead of a name), this will come in handy > so that you can save the user's legitimate values but ask them to > re-enter their invalid values. That gets kind of technical, but it's > one of the sweet things about functions, that they are reuseable. > > Erik > Hi Erik, And thanks again! I like the 'function print_name_form()' -- I gather you could do this for all the NOT NULL variables that a form requires. Further, would you just change the "print_name" to 'print_whatever-other-variable' that I would want to check? Is there another way to consolidate the code at this point? Or would I just duplicate the code for each not-null variable? [Btw, I sometimes long for the old Paradox PAL code that seemed so difficult at the time I learnt it -- PHP is very similar, but the syntax seems so much more compact.] While we're on the topic of fields ('input type=text") is there anyway to include a non-printing space in the data entry, say for 'Name", that would not be passed to the database? Thus, on the screen it would appear: Name: [non-printing space]Andre but in the database entry: Name:Andre This isn't a pressing question, and probably is a formatting question, but I wonder if it's possible? Tia, Andre > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the suffering souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > Now that makes sense. I'm getting a better idea of how it works > together. I > figured there must be a way to control the "Submit" button's behaviour, > but I > didn't know where to look. Yep, the submit input tells the form "go do your thing", but the form already knew where to go (because you specify where to go in the 'action' attribute). The form also knows how to go -- whether it should be POST or GET. Without realizing it, you'll be learning more about the HTTP protocol itself as you start writing scripts that take advantage of its features. > Where would you insert: > > if (!isset($name)) die ("You need to fill in your name. Use the > browser's > back button and input this information."); > > I tried in the php database storage code (didn't work). Tried it after > the > appropriate 'Name' code in the form's html document. Didn't work. I know > that it should work somewhere . . . . > > Somehow, I don't think the "Submit" function is working as it should > (especially if a carriage return or "Enter" can override everything). Is > there some code that will defeat this undesirable activity? Firstly, your browser is what determines how the form is sent -- but usually, it's normal for the Enter key to act as the "Submit" button (a nice keyboard shortcut that I take advantage myself). It should not act in this fashion if you are typing into a textarea tag, because you might want to enter newlines/cr's in the textarea, but for most other form fields it's normal. If you want to jump from one field to the next with a key press, use tab. Secondly, you're wondering where to check for the presence of the data? How about this: "; } if (!$_POST['name']) { print "You need to fill in your name."; print_name_form(); } else { print "Thank you!"; } ?> Why did I define a function in the beginning? Well, this way, if the user didn't enter a name, they don't have to hit "back" in their browser. The form just appears again. This is much more useful if you have this same function accessible from each page/script you are writing, so that you don't have to waste your time. Later, when you learn how to check for errors in your user's input (such as if the user entered a bunch of numbers instead of a name), this will come in handy so that you can save the user's legitimate values but ask them to re-enter their invalid values. That gets kind of technical, but it's one of the sweet things about functions, that they are reuseable. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
On Tuesday 05 March 2002 17:43, you wrote: > On Tuesday, March 5, 2002, at 04:06 PM, Andre Dubuc wrote: > > After inserting variables from a fill-out html form into my database, I > > would > > like the form to "goto" the next html page, but I cannot figure out how > > to do > > this basic function. I assume that when one clicks a "Submit" button, > > the > > info is sent to the server, but how do you call a new page? > > When the "submit" button is hit, the form executes the script located at > the URL specified in the "action" attribute of the tag. So do > this: > $script_target = "./nameofscript.php"; > print ". "; > > in your PHP. If you're new to this, don't worry about using PHP_SELF to > call the same script, just make a new page with the code that handles > the first page's data. But eventually you'll probably want to clean up > your style and use switch() statements or if statements to keep it all > in one page. (Right now I'm working on a 700-line monster that doesn't > even include any HTML!) > > > Erik > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] Hi Eric, Now that makes sense. I'm getting a better idea of how it works together. I figured there must be a way to control the "Submit" button's behaviour, but I didn't know where to look. Thanks again, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the suffering souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
On Tuesday, March 5, 2002, at 04:06 PM, Andre Dubuc wrote: > After inserting variables from a fill-out html form into my database, I > would > like the form to "goto" the next html page, but I cannot figure out how > to do > this basic function. I assume that when one clicks a "Submit" button, > the > info is sent to the server, but how do you call a new page? When the "submit" button is hit, the form executes the script located at the URL specified in the "action" attribute of the tag. So do this: $script_target = "./nameofscript.php"; print ". "; in your PHP. If you're new to this, don't worry about using PHP_SELF to call the same script, just make a new page with the code that handles the first page's data. But eventually you'll probably want to clean up your style and use switch() statements or if statements to keep it all in one page. (Right now I'm working on a 700-line monster that doesn't even include any HTML!) Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php