Poker Forum

Over 1,247,000 Posts!

Subscribe to FTR web feed
Already Registered?      Username:    Password:   Remember      Forgot Password
  >    > 

php

  
 
LinkBack Thread Tools Display Modes
Jeebus Kliest
Old 10-12-2005, 07:56 PM     Post subject: php #1 (permalink)  
Jeebus Kliest's Avatar
3-of-a-Kind

Join Date: Jun 2005
Location: Escondido, CA
Posts: 105
Jeebus Kliest
I don't really know php, just plugging in what makes sense from my c/c++ history.

I have a form that is created and then populated based off specific values in a db.

I want the user to be able to edit those values, and submit them and then have those values updated in the db.

I can get the first part done...

but I can only get the second part done by posting every single variable as its own entity. I would much rather send across the values and run it through a for statement, but I don't believe the post syntax allows for that.

Lets say the posted form field name is

postedname1
postedname2
postedname3

and so on...

to get it to work I have to say...

$value[0] = $_POST['postedname1'];
$value[1] = $_POST['postedname2'];
$value[2] = $_POST['postedname3'];
etc...

I would rather run it something like this...


for($location=0;$location<16;$location++){
$value[$location] = $_POST['postedname$location'];
}

The formatting of that is obviously incorrect as it doesn't work, but how can I change the value of the post value to equal 'postedname1','postedname2' as the for statement goes up?

Anyone....Anyone...bueller...
20K06 - 20k profit by end of 2006
Progress at http://www.crunchy-in-milk.com
 
Reply With Quote
Join the FTR Poker Forum to disable these banners and start posting!
thirteen
Old 10-12-2005, 08:45 PM #2 (permalink)  
Straight

Join Date: Jul 2005
Posts: 235
thirteen
Try this

for($location=0;$location<16;$location++){
$value[$location] = $_POST['postedname'.$location];
}

Concatenate the $location variable rather than sticking it within the quotes. This will work, i had to do something similar in a crunch on a recent project.
Reply With Quote
LeFou
Old 10-12-2005, 11:51 PM #3 (permalink)  
LeFou's Avatar
4-of-a-Kind

Join Date: Jul 2004
Location: Dallas, TX
Posts: 2,361
LeFou
just out of curiosity why are you not using postedname[] -- i.e. an array -- in the form?
Reply With Quote
TylerK
Old 10-13-2005, 02:11 AM     Post subject: Re: php #4 (permalink)  
TylerK's Avatar
4-of-a-Kind

Join Date: Oct 2004
Location: PEANUT BUTTER JELLY TIME
Posts: 1,791
TylerK
Send a message via AIM to TylerK
Quote:
Originally Posted by Jeebus Kliest
Lets say the posted form field name is

postedname1
postedname2
postedname3
Age <input type="text" name="postedname[]">
Sex<input type="text" name="postedname[]">
Location<input type="text" name="postedname[]">

Quote:
Originally Posted by Jeebus Kliest
for($location=0;$location<16;$location++){
$value[$location] = $_POST['postedname$location'];
}
for($i = 0; $i < count($_POST['postedname']); $i++) {
print $_POST['postedname'][$i];
}
TylerK: its just gambling if i want to worry about money i'll go to work lol
 
Reply With Quote
Jeebus Kliest
Old 10-13-2005, 02:13 AM #5 (permalink)  
Jeebus Kliest's Avatar
3-of-a-Kind

Join Date: Jun 2005
Location: Escondido, CA
Posts: 105
Jeebus Kliest
Since postedname is the name of the input box, I wasn't sure if it would allow it to be a variable in the html form itself.

Anyways thanks thirteen that was what I needed. I knew it was a stupid simple syntax error...would help to actually know the language but can get by. Now since that was basically the only thing holding me back I can finish the entire project.
20K06 - 20k profit by end of 2006
Progress at http://www.crunchy-in-milk.com
 
Reply With Quote
Reply
Latest Poker News
KoRnholio Old 05-26-2012, 03:08 PM    Australia Legalized Online Poker coming up in next 6 to 12 Months
According to an email sent out by Mark Bryan, a gaming analyst at Merrill Lynch, the Australian government plans to legalize online poker sometime in the next six to 12 months. This move will coincide ...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:16 PM.


FTR Testimonials

All content
© FlopTurnRiver.com
Advertising  |   Partners  |   Testimonials  |   T&C  |   Contact Us  |   FTR News & Press  |   Site Map  |   Search FTR

Full Tilt  |   Titan Poker  |   UltimateBet  |   Poker Stars  |   Ladbrokes Bonus  |   Sportsbook  |   Cake Poker  

Play Texas Holdem Online, Online Texas Holdem Strategy, & Poker Forum
This is not a gambling website.