Form to Databse Question... Please help.

wxdqz

New Member
I'm trying to use a while statement to take the variables submitted by the form to be insterted into the database. But i'm not quite sure how to do it. Can I use while or do I have to use arrays?

This is basicly my code:

// The form
$number = 1;
$result = mysql_query("SELECT * FROM links");

while ($row = mysql_fetch_row($result)) {

echo "<input type=text name=".$number++."_link value=http://www.phpbuilder.com/board/archive/index.php/$row[0]>";

}

// So what will happen is that there will be a new input box for every result that is returned. The name or variable which will be given is $1_link, $2_link, $3_link etc.. the number keeps increasing as the results are fetched.

//Now in the form processing I want something like the below code. But i'm having problems. What is supposted to happen is that the variables from the form are collected, counted and then for every variable it should inset a row into my table

//The form process code

while ($number++_links) {
code to inset the variables into the database
}

//Should I use while or make some sort of array? I know this is a little confusing heh :)

Any re-code or help would be aprichated.
 
Back
Top