emailconfirmed, nsInternRO, nsInternRW, Administrators
3,356
edits
m (→Das Frontend) |
m (→Das Backend) |
||
Line 77: | Line 77: | ||
// ********** default values ********** | // ********** default values ********** | ||
// fill products with some default values (products) | // fill products with some default values (products) | ||
// note that this is a very simplified example, | |||
// therefore we're using a hard-coded products array here to easily update the form-values | |||
// in a "real life" example, we'd catch the products from the database | |||
$products = array('Shampoo', 'Soap'); | $products = array('Shampoo', 'Soap'); | ||
$sql = "INSERT INTO products | $sql = "INSERT INTO products | ||
Line 94: | Line 97: | ||
foreach($products as $prodName) { | foreach($products as $prodName) { | ||
// replace float "," with "." $_POST['prodPrice'] is from the posted form | // replace float "," with "." $_POST['prodPrice'] is from the posted form | ||
// to prevent wrong values due to german floating point separator "," (comma) instead of the english "." (dot) | |||
$prodPrice = str_replace(",",".",$_POST['prodPrice_'.$i]); | $prodPrice = str_replace(",",".",$_POST['prodPrice_'.$i]); | ||
// update db | // update db | ||
Line 134: | Line 138: | ||
</source> | </source> | ||
== Das Frontend == | == Das Frontend == |