JA brugeren skal selv udfylde feltet med "antal".
har udskrevet til skærm, men der kommer kun en værdi hvis jeg indsætter value="1" eks.vis.
Det er ikke sql der er noget galt med, da alt andet kommer ind i db som det skal
HEle min html kode:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//DK" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html" charset="iso-8859-1"/>
- <title>Bestilling:</title>
- <link rel="stylesheet" href="/natural/css/styles.css" type="text/css"/>
- <link rel="shortcut icon" href="/natural/css/images/favicon.ico">
- </head>
- <body>
-
- <div id="wrapper">
- <div id="header">
- <img src="/natural/css/images/logo.gif" alt="Logo" width="260" height="100" />
- <img src="/natural/css/images/produktsortiment.jpg" alt="produkter" width="418" height="85" />
- </div>
- <div id="menu"> <?php include_once("../css/menu.html"); ?> </div>
- <div id="content">
- <p><?php echo $firma. "<br />".$lev_dato; ?></p>
-
- <?php
- echo "<table><tr>";
- $i=0;
- $antal = 4; // det antal tabeller der vises vertikalt
- ?>
- <form method="POST" action="/natural/shop/action/ordre_action.php">
- <?php
- while($row = mysql_fetch_array($query)) {
- $resultat[] = $row;
- if($i%$antal == 0){
- echo "</tr><tr>";
- }
- ?>
- <td>
- <table border="" cellspacing="2" cellpadding="2" height="170" width="200">
- <input type="hidden" name="dato" value="<?php echo $datee; ?>"/>
- <input type="hidden" name="username" value="<?php echo $user; ?>"/>
- <input type="hidden" name="id" value="<?php echo $id; ?>"/>
- <input type="hidden" name="varenavn" value="<?php echo $row['vare_id']; ?>"/>
- <input type="hidden" name="firma" value="<?php echo $firma; ?>"/>
- <tr><td height="25"><b><?php echo $row['varenavn']; ?></b></td></tr>
- <tr><td height="25">Kolli str.: <?php echo $row['kollistr']; ?></td></tr>
- <tr><td height="25">Pris pr. stk: <input type="text" name="pris" value="<?php echo $row['pris']; ?>"></td></tr>
- [b]<tr><td height="25">Kolli antal:<br /> <input type="text" name="antal" value="3"/></td></tr>[/b]
-
- <?php //if(!empty($row['vare_billede'])): ?>
- <tr><td><img src="css/images/<?php echo $row['vare_billede'];?>" /></td></tr>
- <?php //endif; ?>
- <tr><td><input type="submit" value="Bestil"></td></tr>
- </table></td>
- <?php
- $i++;
- }
- echo "</tr>";
- echo "</table>";
- ?>
- </form>
-
- </div>
- </div>
- </body>
- </html>
og min php fil:
- <?php
- session_start();
- require_once("/../../administrator/config/config.php");
- $ordre_id = $_COOKIE['ordre_id'];
- $antal = mysql_real_escape_string($_POST['antal']);
- $kurv = "INSERT into npjo9_ordre_varenr values('', '$_POST[dato]', '$_POST[firma_id]', '', '$_POST[vare_id]', [b]'$antal'[/b], '$_POST[pris]', '', '', '', '0', '$ordre_id')";
- $query = mysql_query($kurv) or die(mysql_error());
- echo $antal;
- //header("location: ../shop.php");
- //exit;
- ?>
Kan bare ikke se hvor fejlen er.