Trouble with a select list
Posted on
16th Feb 2014 07:03 pm by
admin
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!
I'm trying to add a select list to a form on my webpage.
The select list is generated from information stored in a database.
The table has 25 rows in it presently and what I'm trying to do is list only one column of the rows to create a select list.
An example of this:
Populating a select list with all of the names in a member database.
Here is the relevant code:
$ReqQry=" SELECT `traitname` FROM `traitslist` ";
$ReqResult= mysqli_query($cxn , $ReqQry)or die('Ya did it wrong');
$TraitInfo= mysqli_fetch_assoc($ReqResult);
$TraitCnt= mysqli_num_rows($ReqResult);
$list1=$TraitCnt;
echo "Required Skill 1-"."</br>";
echo "<select id='Req1'>";
foreach($TraitInfo as $v)
{
while($list1 > 0)
{
echo "<option value='$v'>$v</option>";
$list1--;
}
}
echo "</select>"."</br></br>";
The problem that I am having is that the select list generates the same entry 25 times.
Any help would be appreciated, as I have fiddled around with it for about two days in my off-time and no luck yet. Thanks
*ps* I'm still rather wet behind the ears with PhP so be gentle
No comments posted yet
Your Answer:
Login to answer
300
52
Other forums
Form submissing with PHP and JQuery/Ajax
I have searched everywhere, but cannot find a solution for this... I have worked all day trying to g
Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to a
asking for direction
I have 2 tables in my data, which are "post" and "event"
I won't make a summa
try catch error
I have been trying try catch but, I can't get it to work. The code opens a non existing file called
Query output more than expected
$query=mysql_query("SELECT * FROM players, communities, divisions WHERE dob BETWEEN '{$start_da
mysq_num_rows
Hi,
I want to use:
Code: if(mysql_num_rows($ergebnis2)==2)
how can the value 2, be
i have no idea why this isn't working
Code: <?php
session_start();
include("connect.php");
error_reporting(E
PHP Thumbnail Creation
Ok so i use this function to create thumbnails:
Code: function createthumb($name,$filename,$n
HTML form problem
Ive made a form to that i want to send to my email via PHP. but when it send only the name's etc sen
form class help (oop php5)
Hidy Ho Neighbors,
I'm forcing myself to learn oop/classes for php5. It seems like a good id