Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   PHP - Help Needed Please. (http://www.go4expert.com/forums/php-help-t27845/)

Brentatechnologies 21Feb2012 04:50

PHP - Help Needed Please.
hey there,

Been a while since I posted on the forums...I have been working on a project for school...
and so far it's coming along nicely, but, I have run into a problem...

I'd like to create a drop down list with php and send the data selected from the drop-down to a database in which i've made...That's just one problem

Second problem...
Where would I start with creating an item database...I'll start off small a list of 50 items available to "buy" from a "market"

Third Problem...
I'd like to make a combat/stat system but once again no idea where to start...

This is a text-based game turn based (still to implement turn base) and you can view what I have done at


pein87 3Mar2012 12:39

Re: PHP - Help Needed Please.
Create a while loop and place the values needed. Ok so lets say you have a database with the fields

item_id, item_name

you'd need to fetch an array of the dataset and display it

PHP Code:

echo "<select>";
$arr mysql_fetch_assoc($result)) !== null)

"<option value=\"$arr['item_name']\">" $arr['item_name'] . " </option>";



Its important to not put the select tags in the loops output or you'll get an ugly surprise. Instead the loop serves to print an option for each result that exits in that table. Hope this gets you started. I assume you know how to connect to a database etc...

All times are GMT +5.5. The time now is 05:29.