RE: [PHP] Values from forms
-Original Message- From: Beauford.2005 [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 00:36 Thanks for the info. The first suggestion doesn't work, The first suggestion does work -- I've used it more than once in the past. If it doesn't work for you, you're doing something wrong. But the array solution is better. and the second may work - but the problem is I need the array to start at '1' - and arrays in general start at 0. PHP arrays start wherever they start -- by default, if you don't specify otherwise, they start at 0, but they can start with anything (e.g. array('foo'='bar', 'plugh'='xyzzy') starts at 'foo') -- so if you want one to start at 1 then just start it at 1. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Values from forms
Small brain cramp here. I have the following form and having problems retrieving the values from it. FORM ACTION=teams-write.php action=post name=inputs input type=hidden name=count value=? echo $number; ? // $number gets inputted from another form (this works) ? for($i = 1; $i $number + 1; $i++) { ? input type=text name=team? echo $i; ? SIZE=10 ? } ? This is teams-write.php: The problem I am having is getting the values inputted in the above form in the for loop below. If I just echo $team1, $team2, etc. they are there, I just can't figure out how to get the values inputted into my database. In the loop below, what would I put in the second values section to get the values of $team1, $team2, etc. for($i=1; $i $count + 1; $i++) { mysql_query(insert into manager (idn, name) values ('$i','???')); } TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Values from forms
--- Beauford.2005 [EMAIL PROTECTED] wrote: FORM ACTION=teams-write.php action=post name=inputs You misspelled method. :-) Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Values from forms
Hello, This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at 00:05, lines prefixed by '' were originally written by you. $team2, etc. they are there, I just can't figure out how to get the values inputted into my database. In the loop below, what would I put the second values section to get the values of $team1, $team2, etc. for($i=1; $i $count + 1; $i++) { mysql_query(insert into manager (idn, name) values ('$i','???')); TIA ${'team'.$i} will work but it would lead to tider code if you got your data into the script using an array... input name='test[0]'... input name='test[1]'... input name='test[2]'... etc... All the best, David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Values from forms
--- Beauford.2005 [EMAIL PROTECTED] wrote: FORM ACTION=teams-write.php action=post name=inputs You misspelled method. :-) Hope that helps. Chris It seems like this exact same problem has been addressed before. http://marc.theaimsgroup.com/?l=php-generalm=105900603231518w=2 http://marc.theaimsgroup.com/?l=php-generalm=105906453817129w=2 Having the action attribute in there twice will mess stuff up. You might want to check all of your forms since this seems to be a re-occurring problem, it'll probably save you some time and frustration. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Values from forms
David, Thanks for the info. The first suggestion doesn't work, and the second may work - but the problem is I need the array to start at '1' - and arrays in general start at 0. Any ideas? TIA -Original Message- From: David Nicholson [mailto:[EMAIL PROTECTED] Sent: August 4, 2003 7:11 PM To: Beauford.2005 Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Values from forms Hello, This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at 00:05, lines prefixed by '' were originally written by you. $team2, etc. they are there, I just can't figure out how to get the values inputted into my database. In the loop below, what would I put the second values section to get the values of $team1, $team2, etc. for($i=1; $i $count + 1; $i++) { mysql_query(insert into manager (idn, name) values ('$i','???')); TIA ${'team'.$i} will work but it would lead to tider code if you got your data into the script using an array... input name='test[0]'... input name='test[1]'... input name='test[2]'... etc... All the best, David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- 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] Values from forms
Hello, This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at 00:39, lines prefixed by '' were originally written by you. Thanks for the info. The first suggestion doesn't work, What error did you get? and the second may work - but the problem is I need the array to start at '1' - and arrays in general start at 0. Arrays can have whatever you want as the keys, if you want them to start at one, start them at one! HTH David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php