Re: [PHP] Why does this happen?
H... So in the receiving page I'll need to string together date_year[i], date_month[i] and date_day[i] in order to get the full date for each scheduled game. Which is what CF apparently "glues together" for the developer on the fly. I'll try out both this method and the array method suggested by OP (I need practice working with arrays in PHP anyway). Thanks for the informative reply, --Noah - Original Message - From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]> To: "'CF High'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, February 10, 2003 5:28 AM Subject: RE: [PHP] Why does this happen? > > -Original Message- > > From: CF High [mailto:[EMAIL PROTECTED]] > > Sent: 09 February 2003 20:52 > > > > Here's the deal: > > > > Let's say I have a form that requests the season schedule of > > a baseball > > team, and the team in question has twenty scheduled games all > > on different > > days. > > > > Each form row will have three select elements for the date; > > i.e. date(x) for > > the year, date(x+1) for the month, and date(x+2) for the day, > > or however > > I'll need to make each date select element unique. > > > > Then, in the insert page, I'll need to loop through each date > > element by > > groups of three and create an array for each date set. > > If I'm reading this right, you need to do something like this on your form > page: > > > for ($i=1; $i<=20; $i++): > ?> > > ... > > > ... > > ... > endfor; > ?> > > > and then your receiving page will have arrays called $_POST['date_year'], > $_POST['date_month'], etc (or the equivalent globals if you've chosen the > insecure register_globals On route). > > 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
RE: [PHP] Why does this happen?
> -Original Message- > From: CF High [mailto:[EMAIL PROTECTED]] > Sent: 09 February 2003 20:52 > > Here's the deal: > > Let's say I have a form that requests the season schedule of > a baseball > team, and the team in question has twenty scheduled games all > on different > days. > > Each form row will have three select elements for the date; > i.e. date(x) for > the year, date(x+1) for the month, and date(x+2) for the day, > or however > I'll need to make each date select element unique. > > Then, in the insert page, I'll need to loop through each date > element by > groups of three and create an array for each date set. If I'm reading this right, you need to do something like this on your form page: ... ... ... and then your receiving page will have arrays called $_POST['date_year'], $_POST['date_month'], etc (or the equivalent globals if you've chosen the insecure register_globals On route). 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
RE: [PHP] Why does this happen?
> -Original Message- > From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]] > Sent: 09 February 2003 14:39 [OP snipped] > I don't know much about CF, but in plain HTML as you show > here you have 3 > different form input (select) fields sharing the same name. Thus the > browser will transmit only one of the three input (select) fields upon > submit (it is undefined which field will be sent, but most > browsers will > transmit the last value). No, that's not true. The browser will transmit them all -- it's up to whatever's receiving the POST to decide what to do with the duplicates. ColdFusion obviously glues them together, whereas PHP ignores all except the last. > > Year > > 2002 > > Month > > 12 > > Day > > 25 > > > > > In your receiving script you would have an associative array > named "date" > in the $_REQUEST structure: > > $date_received = $_REQUEST['date']; > $year = $date_received['Y']; > $month = $date_received['M']; > $day = $date_received['D']; That's one way to do it. Personally, I'd just name the fields date_year, date_month and date_day -- using an array here seems like unnecessary complexity. I'd save arrays for when I really need them -- like if I have a multi-row form where each row has year/month/day fields. 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
Re: [PHP] Why does this happen?
Hey Ernest. This looks like the solution I'll need to make my CF interface work in PHP. I'll check it out. Thanks! --Noah - Original Message - From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]> To: "CF High" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, February 09, 2003 6:39 AM Subject: Re: [PHP] Why does this happen? > At 04:52 09.02.2003, CF High said: > [snip] > >In this test form when I submit and insert into my db, only the last select > >field get entered; i.e. in this case the day value of 25. > > > > > > > >Year > > > >2002 > > > > > >Month > > > >12 > > > > > >Day > > > >25 > > > > > > > > > > > > > >Why does this happen? In Cold Fusion I'm able to refer to the three selects > >as #date# and it returns 20021225 as expected. > [snip] > > I don't know much about CF, but in plain HTML as you show here you have 3 > different form input (select) fields sharing the same name. Thus the > browser will transmit only one of the three input (select) fields upon > submit (it is undefined which field will be sent, but most browsers will > transmit the last value). > > Maybe CF fiddles around with the element names, PHP doesn't. You could e.g. > format the 3 elements to transmit an array, something like this: > > > Year > > 2002 > > Month > > 12 > > Day > > 25 > > > > > In your receiving script you would have an associative array named "date" > in the $_REQUEST structure: > > $date_received = $_REQUEST['date']; > $year = $date_received['Y']; > $month = $date_received['M']; > $day = $date_received['D']; > > HTH, > > > -- >>O Ernest E. Vogelsinger >(\)ICQ #13394035 > ^ http://www.vogelsinger.at/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why does this happen?
Alright, alright, everyone, I could get away with this in Cold Fusion, but not in PHP. The simple example I gave is part of a more complex problem, however. Here's the deal: Let's say I have a form that requests the season schedule of a baseball team, and the team in question has twenty scheduled games all on different days. Each form row will have three select elements for the date; i.e. date(x) for the year, date(x+1) for the month, and date(x+2) for the day, or however I'll need to make each date select element unique. Then, in the insert page, I'll need to loop through each date element by groups of three and create an array for each date set. Similar to what I had to do in CF, but I could get away with naming each row of select elements as date(x) for year, date(x) for month, date(x) for day, etc. My ideas might be a little primitive here, so feel free to chime in if you've got a tighter solution Thanks, --Noah "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000a01c2cfdd$5f9c5c40$7c02a8c0@coconut">news:000a01c2cfdd$5f9c5c40$7c02a8c0@coconut... > > Got a problem with I'm sure a simple solution:: > > > > In this test form when I submit and insert into my db, only the last > > select > > field get entered; i.e. in this case the day value of 25. > > > > > > > > Year > > > > 2002 > > > > > > Month > > > > 12 > > > > > > Day > > > > 25 > > > > > > > > > > > > All of your form elements have the same name! What do you expect to > happen? > > If you have this in PHP: > > $date = 1; > $date = 2; > $date = 3; > > What value do you think $date has now?? > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why does this happen?
At 04:52 09.02.2003, CF High said: [snip] >In this test form when I submit and insert into my db, only the last select >field get entered; i.e. in this case the day value of 25. > > > >Year > >2002 > > >Month > >12 > > >Day > >25 > > > > > > >Why does this happen? In Cold Fusion I'm able to refer to the three selects >as #date# and it returns 20021225 as expected. [snip] I don't know much about CF, but in plain HTML as you show here you have 3 different form input (select) fields sharing the same name. Thus the browser will transmit only one of the three input (select) fields upon submit (it is undefined which field will be sent, but most browsers will transmit the last value). Maybe CF fiddles around with the element names, PHP doesn't. You could e.g. format the 3 elements to transmit an array, something like this: Year 2002 Month 12 Day 25 In your receiving script you would have an associative array named "date" in the $_REQUEST structure: $date_received = $_REQUEST['date']; $year = $date_received['Y']; $month = $date_received['M']; $day = $date_received['D']; HTH, -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why does this happen?
Because all of your field names are overwriting each other until the last one wins. name="date" This needs to be different for each field so PHP can assign that name as the variable. HTH, Jason k Larson CF High wrote: Hey all. Got a problem with I'm sure a simple solution:: In this test form when I submit and insert into my db, only the last select field get entered; i.e. in this case the day value of 25. Year 2002 Month 12 Day 25 Why does this happen? In Cold Fusion I'm able to refer to the three selects as #date# and it returns 20021225 as expected. Any ideas? Thanks, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why does this happen?
> Got a problem with I'm sure a simple solution:: > > In this test form when I submit and insert into my db, only the last > select > field get entered; i.e. in this case the day value of 25. > > > > Year > > 2002 > > > Month > > 12 > > > Day > > 25 > > > > > All of your form elements have the same name! What do you expect to happen? If you have this in PHP: $date = 1; $date = 2; $date = 3; What value do you think $date has now?? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why does this happen?
Maybe you should rename them differently/ or make then into an array? -Original Message- From: CF High [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 08, 2003 10:52 PM To: [EMAIL PROTECTED] Subject: [PHP] Why does this happen? Hey all. Got a problem with I'm sure a simple solution:: In this test form when I submit and insert into my db, only the last select field get entered; i.e. in this case the day value of 25. Year 2002 Month 12 Day 25 Why does this happen? In Cold Fusion I'm able to refer to the three selects as #date# and it returns 20021225 as expected. Any ideas? Thanks, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why does this happen?
Hey all. Got a problem with I'm sure a simple solution:: In this test form when I submit and insert into my db, only the last select field get entered; i.e. in this case the day value of 25. Year 2002 Month 12 Day 25 Why does this happen? In Cold Fusion I'm able to refer to the three selects as #date# and it returns 20021225 as expected. Any ideas? Thanks, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why does this happen?
Edit only the # sign and the 6 characters following it. There is a good color reference at http://www.visibone.com/colorlab/ -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:48 AM To: 'Jay Blanchard' Subject: RE: [PHP] why does this happen? Jay I got it fixed... How do I edit the font and the colors of tables and backgrounds Go ahead and it refresh!! -Original Message- From: Jay Blanchard [mailto:jay.blanchard@;niicommunications.com] Sent: Tuesday, November 05, 2002 11:39 AM To: 'Karl James'; 'PHP General' Subject: RE: [PHP] why does this happen? And all you changed was the tag? If so, the code you sent was before you chnaged it to (those are zeros) -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:35 AM To: 'Jay Blanchard' Subject: RE: [PHP] why does this happen? Here is the code jay! 2002 Players Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ">"; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; } mysql_free_result($result); print ""; function ShowTable($name){ MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect"); @MYSQL_SELECT_DB("$dbName") OR DIE("Unable to select database"); $query = "select * from $name"; $result = MYSQL_QUERY($query); $total_rows = mysql_num_rows($result); if (!$total_rows) { print "Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ""; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; print ""; } print ""; } ?> -Original Message- From: Jay Blanchard [mailto:jay.blanchard@;niicommunications.com] Sent: Tuesday, November 05, 2002 11:32 AM To: 'Karl James'; 'PHP General' Subject: RE: [PHP] why does this happen? [snip] I did the changes but. Now nonthing appears at all on the web page Please refresh to see what im saying.. [/snip] Now, if that was all you changed you should not have a problem, but you must have changed more than that because now there is nothing in the page. Can you show us your code? [hint to get more help] When responding to a post where someone attempts to help you make sure to respond to the mailing list in the event the original helpful citizen went to a meeting or the bathroom or something. [/hint] JB -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why does this happen?
Dude, forget colors and stuff for the moment, you just want to get the page to display properly. You have many problems where your print statements are concerned without going into the coat of many colors. -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:43 AM To: 'Jay Blanchard' Subject: RE: [PHP] why does this happen? I changed all font codes to #33 And nothing happend -Original Message- From: Jay Blanchard [mailto:jay.blanchard@;niicommunications.com] Sent: Tuesday, November 05, 2002 11:39 AM To: 'Karl James'; 'PHP General' Subject: RE: [PHP] why does this happen? And all you changed was the tag? If so, the code you sent was before you chnaged it to (those are zeros) -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:35 AM To: 'Jay Blanchard' Subject: RE: [PHP] why does this happen? Here is the code jay! 2002 Players Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ">"; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; } mysql_free_result($result); print ""; function ShowTable($name){ MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect"); @MYSQL_SELECT_DB("$dbName") OR DIE("Unable to select database"); $query = "select * from $name"; $result = MYSQL_QUERY($query); $total_rows = mysql_num_rows($result); if (!$total_rows) { print "Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ""; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; print ""; } print ""; } ?> -Original Message- From: Jay Blanchard [mailto:jay.blanchard@;niicommunications.com] Sent: Tuesday, November 05, 2002 11:32 AM To: 'Karl James'; 'PHP General' Subject: RE: [PHP] why does this happen? [snip] I did the changes but. Now nonthing appears at all on the web page Please refresh to see what im saying.. [/snip] Now, if that was all you changed you should not have a problem, but you must have changed more than that because now there is nothing in the page. Can you show us your code? [hint to get more help] When responding to a post where someone attempts to help you make sure to respond to the mailing list in the event the original helpful citizen went to a meeting or the bathroom or something. [/hint] JB -- 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] why does this happen?
And all you changed was the tag? If so, the code you sent was before you chnaged it to (those are zeros) -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:35 AM To: 'Jay Blanchard' Subject: RE: [PHP] why does this happen? Here is the code jay! 2002 Players Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ">"; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; } mysql_free_result($result); print ""; function ShowTable($name){ MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect"); @MYSQL_SELECT_DB("$dbName") OR DIE("Unable to select database"); $query = "select * from $name"; $result = MYSQL_QUERY($query); $total_rows = mysql_num_rows($result); if (!$total_rows) { print "Table $name is empty"; return; } $row = mysql_fetch_row($result); $total_cols = count($row); print ""; print ""; print "$name Table (rows: $total_rows, column: $total_cols)"; print ""; $i=0; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; while($row = mysql_fetch_row ($result)) { $i = 0; print ""; while($i < $total_cols){ print ""; print $row[$i]; print ""; $i++; } print ""; print ""; } print ""; } ?> -Original Message- From: Jay Blanchard [mailto:jay.blanchard@;niicommunications.com] Sent: Tuesday, November 05, 2002 11:32 AM To: 'Karl James'; 'PHP General' Subject: RE: [PHP] why does this happen? [snip] I did the changes but. Now nonthing appears at all on the web page Please refresh to see what im saying.. [/snip] Now, if that was all you changed you should not have a problem, but you must have changed more than that because now there is nothing in the page. Can you show us your code? [hint to get more help] When responding to a post where someone attempts to help you make sure to respond to the mailing list in the event the original helpful citizen went to a meeting or the bathroom or something. [/hint] JB -- 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] why does this happen?
[snip] I did the changes but. Now nonthing appears at all on the web page Please refresh to see what im saying.. [/snip] Now, if that was all you changed you should not have a problem, but you must have changed more than that because now there is nothing in the page. Can you show us your code? [hint to get more help] When responding to a post where someone attempts to help you make sure to respond to the mailing list in the event the original helpful citizen went to a meeting or the bathroom or something. [/hint] JB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why does this happen?
Change your to The text is set to white. -Original Message- From: Karl James [mailto:karl.james@;verizon.net] Sent: Tuesday, November 05, 2002 4:15 AM To: [EMAIL PROTECTED] Subject: [PHP] why does this happen? Hey guys Im trying to print all the names in this table and To do alternating colors, with check boxes on the last Column When I tried this.my site will not display any names What so ever. And I tried some example code for the alternating colors But its not working the way it should The site is http://www.ultimatefootballleague.com/php/2002players.php and http://www.ultimatefootballleague.com/php/2002players.phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why does this happen?
Hey guys Im trying to print all the names in this table and To do alternating colors, with check boxes on the last Column When I tried this.my site will not display any names What so ever. And I tried some example code for the alternating colors But its not working the way it should The site is http://www.ultimatefootballleague.com/php/2002players.php and http://www.ultimatefootballleague.com/php/2002players.phps
[PHP] why does this happen
Hi, I am trying to write a php and javascript that will pick up data from a table and display and scroll it. I seem to have run out of ideas how to make the script work. I don't get any display on the screen. I use rand() limit 1 so only one row is selected. Can some one tell me where I went wrong? Adrian =cscroll.php === data = $data; foreach($data as $row) { //create list of unique choices for first selector $this->tcity[($row[A-City])] = $row[A-City]; $this->tcurr1[($row[A-curr1])] = $row[A-curr1]; $this->tcatalogo[($row[A-catalogo])] = $row[A-catalogo]; $this->thf[($row[A-hf])] = $row[A-hf]; $this->tcurr2[($row[A-curr2])] = $row[A-curr2]; $this->tvitofferta[($row[A-vitofferta])] = $row[A-vitofferta]; $this->tfh[($row[A-fh])] = $row[A-fh]; } } } function initialize() { echo (""); echo("data[A-city]\">"); echo(""); } scroll.php while($row = mysql_fetch_object($result)) { $tarray[] = array( A-city=>$row->city, A-curr1=>$row->curr1, A-catalogo=>$row->catalogo, A-hf=>$row->hf, A-curr2=>$row->curr2, A-vitofferta=>$row->vitofferta, A-fh=>$row->fh, ); } //instantiate class $tscroll = new cscroll( $tarray); ?>