Jump to content

Recommended Posts

I have a table filled with data that I get returned from MySQL using the mysql_fetch_array() function.

 

Within the table rows, I have an input box that I would like to set each value different.

 

Eg. $qty[0], $qty[1], $qty[2].

 

And so on, until it reaches the end of the data range set.

 

Is this possible? Simple? Any help most apprecaited.

Link to comment
https://forums.phpfreaks.com/topic/126712-probably-very-simple-answer-i-hope/
Share on other sites

<?php $res=array("cat","dog","pig"); ?>

<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>" ">

<br>

<?php foreach( $res as $r){

$replace=array("cat","pig",$r);

$replace_with=array("mice","tigger",$r);

$r=str_replace($replace,$replace_with,$r);
?>

<input type="test" name="<?php echo $r; ?>" value="<?php echo $r;?>" >

<?php } ?>

<br>

<input type="submit" name="submit" value="SEND!">

</form>

that would work for a dataset that only returns 1 row.. but say i have 5 or 10 rows of data.

 

 

 

why do you think that?

 

You will have to alter the [ 0 ] to the correct column offset for the qty value.

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.