Jump to content

dynamically building script


j3rmain3

Recommended Posts

I have created a table that contains links and dropdown menus. This is how i have set it up

[code]while ($row=mysql_fetch_row($result) > 0){

echo "<tr>"
echo "<td>".$row[filename]."</td>";    //---- I have done it like this so the table is automatically updated when new data has been added to the database-----//
echo "<td><a href=http://www.mysite/$row[url]>$row[filename]";
echo "<select name=rating>
                <option value=1 name=$row[filename]tech>1 - Awful
        <option value=2 name=$row[filename]tech>2 - Poor
                <option value=3 name=$row[filename]tech>3 - Average
                <option value=4 name=$row[filename]tech>4 - Ok
                <option value=5 name=$row[filename]tech>5 - Excellent</td>";
echo "</select>";[/code]

imagine $row[filename] is currently holding only three records which are "sega","nintendo","microsoft". i want the dropdown options to be named segatech, nintendotech, microsofttech which it does perfectly.

But then i want the option to be moved from the form and to be displayed in the table. To do so, the header of the php which the is form is being processed to needs to have:

$segatech = $_POST['segatech'];
$nintendotech = $_POST['nintendotech'];
$microsofttech = $_POST['microsofttech'];

I want this to be built dynamically so whenever a new record was to appear it would then place itself at the bottom of the post section. for example if a new record with the name "sony" was to be added to the database, a new line would be added:

$sonytech = $_POST['sonytech'];

and this would be generated in the file.

Is there a loop which i could create so this could be done dynamically or will i have to enter one in for each record.

thanks

j3rmain3
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.