[PHP] Form and php
Hello, I use a html form and php with global registers off how do I get the names and values from that form? I use $_POST[FIELD NAME]; but I have much more fields. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form and php
T, Couple of things to try: $_REQUEST[Field Name] or you could extract the values http://www.php.net/extract Till We Meet Again... Clifford W. Hansen Operations Support Developer Aspivia (Pty) Ltd. +27 (0) 11 259-1150 (Switchboard) +27 (0) 11 259-1019 (Fax) +27 (0) 83 761-0240 (Mobile) [EMAIL PROTECTED] (EMail) http://chansen.aspivia.com (Web) Registered Linux user number 343424 on http://counter.li.org/ We have seen strange things today! Luke 5:26 This message contains information intended for the perusal, and/or use (if so stated), of the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon the information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone and return and/or destroy the original message. The views or representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form and php
Hi, I jsut install apache1.3.26 and php 4.2.3 on my win2000 machine for my course project. when I run: ? phpinfo(); ? everything works fine, it will show me the information. but when I try the followings, it give me an error: test.html html titleThis page is for Power Calculation/title body form action=testphp1.php method=GET Variable 1: input type=text name=varone Variable 2: input type=text name=vartwo br input type=submit name=submit value=Submit Variables input type=reset /form /body /html testphp1.php html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is $varone); print(the second variable is $vartwo); ? /body /html error message Test the value of tmp variable is 20 Notice: Undefined variable: varone in c:\apache\htdocs\testphp1.php on line 8 the first variable is Notice: Undefined variable: vartwo in c:\apache\htdocs\testphp1.php on line 9 the second variable is *** please help me, thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form and php
I believe - html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is . $_POST['varone']); print(the second variable is . $_POST['vartwo']); ? /body /html Tao Hou wrote: Hi, I jsut install apache1.3.26 and php 4.2.3 on my win2000 machine for my course project. when I run: ? phpinfo(); ? everything works fine, it will show me the information. but when I try the followings, it give me an error: test.html html titleThis page is for Power Calculation/title body form action=testphp1.php method=GET Variable 1: input type=text name=varone Variable 2: input type=text name=vartwo br input type=submit name=submit value=Submit Variables input type=reset /form /body /html testphp1.php html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is $varone); print(the second variable is $vartwo); ? /body /html error message Test the value of tmp variable is 20 Notice: Undefined variable: varone in c:\apache\htdocs\testphp1.php on line 8 the first variable is Notice: Undefined variable: vartwo in c:\apache\htdocs\testphp1.php on line 9 the second variable is *** please help me, thank you -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here)
Only typed it up in like 20 min, i normaly do that [code tidying] after :) hehe tisk tisk...the merits of design havent been hammered through you yet? you are lucky!!! But, this does raise an interesting issuegood PHP code structure/form. What do people consider good PHP form? Ive coded in both PHP and ASP and in both OO and function oriented. Ultimately, i find functionally oriented PHP to be the best ... what do other people think? AndrewH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here)
Many of my other scripts i use functions, and classes, first time i used cases and switchs..was fun but i still like to use loops and functions more :) hehehee - Original Message - From: Andrew Halliday [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 02, 2001 6:29 PM Subject: [PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here) Only typed it up in like 20 min, i normaly do that [code tidying] after :) hehe tisk tisk...the merits of design havent been hammered through you yet? you are lucky!!! But, this does raise an interesting issuegood PHP code structure/form. What do people consider good PHP form? Ive coded in both PHP and ASP and in both OO and function oriented. Ultimately, i find functionally oriented PHP to be the best ... what do other people think? AndrewH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] OO v. Functions Was: Re: [PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here)
Ive coded in both PHP and ASP and in both OO and function oriented. Ultimately, i find functionally oriented PHP to be the best ... what do other people think? Having learnt how to program using Basic when I was 8, I had to unlearn a lot of things as I moved from Basic to Pascal (what? I can't just Goto wherever I want to?) then to C (a point-what?) and then a self-imposed exile from programming only to rediscover it with Actionscripting (Flash) and Lingo (Director) before trying out Python and finally loving PHP! Why all this? Well it kinda charts my move from unplanned-write-as-you top-down programming to function-based programming to object-oriented (which is something I thought I had missed the boat on during the time I stopped programming). Although it took a while for me to get my head around it my favorite has to be Object Oriented. It's shocking to see my own transformation from someone who would rather write hours of code then adapt someone else's code to someone who'd rather scour the net looking for a ready-made class that can then be extended. Although PHP is not a real object oriented language, I still prefer using the oo logic whenever possible. Although I guess there are times when you can't use classes in PHP (has anyone been able to create a custom session handler *class*, for example?.. how would you set up the session_set_save_handler that takes strings to point to the various handler functions from within a class?) I try to whenever I can. I think the words I love most lately are abstract, modular, and portable and though it usually takes lots more planning and perhaps a little bit more time spent conding at first for those adjectives to apply to your code, I believe it's definitely worth it! OK, ok, I won't write to the list again first thing after I get up... I sure can ramble! __ ([EMAIL PROTECTED]) New Media Producer, Kismia, Inc. ([EMAIL PROTECTED]) Adj. Prof., American University ¯¯ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here)
Andrew Halliday wrote: Ive coded in both PHP and ASP and in both OO and function oriented. Ultimately, i find functionally oriented PHP to be the best ... what do other people think? As much classes/objects as possible, imo. 'functions' by themselves are OK for smaller stuff, but when you start getting larger projects, and need to make changes - heaven help you, unless you're smart enough to have made most/all of your parameters passed into the functions into one big array. having multiple function calls in various places like $x = calculateFreight($sku,$state) when you then need to add 'weight' as a parameter is a pain. It's more of a pain if I have to remember what order the parameters go in - I have to do $x = calculateFreight($sku,$state,$weight); not $x = calculateFreight($sku,$weight,$state); else my function will be problematic. Being able to do something like $x = new item(); $x-weight= 1; $x-state = 2; $x-sku = 3; $x-calculateFreight(); without worrying about the order of the parameters helps a lot, imo. To each his own tho. -- Michael Kimsal PHP training courses http://www.tapinternet.com/php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Form (aka:Re: [PHP] Can any one spot the Parse error Here)
It's more of a pain if I have to remember what order the parameters go Yeah, good point. I can see that. What i have been doing is componentising the page into functions which are responsible for rendering a discrete section of that page...ie if a page consists of a title bar and a form and the form gets processed by that same page, which can print a response in place of the form upon submission... function renderTitle() { echo table; echo ...; echo /table; } function renderForm() { echo form; echo ...; echo /form; } function renderFormSubmitResponse() { echo bThankyou!/b; } Then all you have to do is put logic at the front of your code to determine what 'page components' get rendered. Also, this way you start to build up a set of common functions, like ones to display query results in a table, populate a form by creating dynamic Java Script etc etc Just a thought on the way to do things, thassal, interesting to compare techniques. It scares me as to how few people seem to worry about form these days ... AndrewH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] form and php
I had a form with just with one button, the action is a PHP file. And when I hit "enter" the button (submit) form action was done. Then I put other button (change) on this form, and now when I hit enter, beside the "pressed" button is the second one (I want that when I hit "enter" the submit button is pressed), the PHP stops and the screen of the IE5 stays blank. What I should do to solve this problem? thanks. Augusto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] form and php
Hi, i'm sorry but I don't quite get what you mean. Which button is pressed. or post the code. Johannes "Augusto Cesar Castoldi" [EMAIL PROTECTED] schrieb im Newsbeitrag Pine.GSO.4.10.10103271417160.12546-10@venus">news:Pine.GSO.4.10.10103271417160.12546-10@venus... I had a form with just with one button, the action is a PHP file. And when I hit "enter" the button (submit) form action was done. Then I put other button (change) on this form, and now when I hit enter, beside the "pressed" button is the second one (I want that when I hit "enter" the submit button is pressed), the PHP stops and the screen of the IE5 stays blank. What I should do to solve this problem? thanks. Augusto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] form and php
Hi Augusto, Submit buttons aren't that special, they just send a name=value pair. Doing something like this : If the following is pressed, if ($action == 'edit') will return true. input type="submit" name="action" value="edit" If the following is pressed, if ($action == 'new') will return true. input type="submit" name="action" value="new" See? Regarding what gets sent while pressing the enter key, not exactly sure on that, you can use javascript to help determine. Check out : http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html And do some google searches for terms such as "enter, key, form, submit, javascript, html" and some others. And here's a thread that will help, some ideas within are better then others : [PHP] multiple submit buttons : --- http://marc.theaimsgroup.com/?l=php-generalm=97513765915454w=2 It's a very lengthy thread :-) regards, Philip Olson http://www.cornado.com/ On Tue, 27 Mar 2001, Augusto Cesar Castoldi wrote: I had a form with just with one button, the action is a PHP file. And when I hit "enter" the button (submit) form action was done. Then I put other button (change) on this form, and now when I hit enter, beside the "pressed" button is the second one (I want that when I hit "enter" the submit button is pressed), the PHP stops and the screen of the IE5 stays blank. What I should do to solve this problem? thanks. Augusto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]