rgb192
asked on
add select input field
add a select input field that has the value 'quantity' by default
other choices are
1
2
3
I think something like this
echo '<td>quantity:<input type="select" id ="quantity" name = "quantity['.$p['quantity'] .']" value="'.$p['quantity']"'> </td>
other choices are
1
2
3
I think something like this
echo '<td>quantity:<input type="select" id ="quantity" name = "quantity['.$p['quantity']
<?php
//connect to db first
//...
require_once('inc/common.php');
if( isset($_POST) && !empty($_POST) )
{
foreach($_POST['productid'] as $id =>$v){
$productid=$_POST['productid'][$id];
$title=$_POST['title'][$id];
$internalsku=$_POST['internalsku'][$id];
dbquery("UPDATE products SET title = '$title',internalsku='$internalsku' WHERE productid = '$productid'");
}
echo "Updated";
exit;
}
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
echo '<table>'; // this is echoing html //
$sql=dbquery("select * from products where folderid=120 order by productid desc"); // this selecting all products from db //
foreach ($sql as $p){ //unsure of this i think hes changeing sql to p//
echo '<tr><td>productid:<input type="text" id="productid" name="productid[' . $p['productid'] . ']" value="'.$p['productid'].'" style="width:500px;">'; // now lists all data in a table by product id//
echo '<td>title:<input type="text" id="title" name="title['.$p['productid'].']" value="'.$p['title'].'" style="width:500px;"></tr>';
echo '<td>title:<input type="text" id="internalsku" name="internalsku['.$p['productid'].']" value="'.$p['internalsku'].'" style="width:500px;"></tr>';
} // now lists all products by title //
echo '</table>'; // end of html table//
echo "<div><input type='submit' name='trigger' value='Submit' /></div>";
echo "</form>";
?>
using loop
<?php
echo "<select name=quantity>";
echo "<option value=". "0" .">Quantity</option>";
for($i=1; $i <= 3; $i++) echo "<option value=". $i .">" . $i . "</option>";
echo "</select>";// Closing of list box
?>
ASKER
that makes select fields
look exactly like
" . $i . "
with NO numbers
look exactly like
" . $i . "
with NO numbers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
echo 'quantity:<select id ="quantity" name = "quantity"><option>quantit