Bollard Posted June 11, 2010 Share Posted June 11, 2010 Hello, Im pretty new to this and am trying to create a basic stock search / request quote page. Ive setup the MySQL database fine, and ive got the majority of it working. The user searches for a part, the query displays a table of results. The columns are RFQ, Part Number, Manufacturer, Stock, Quantity, Delivery. The user ticks a part they want a quote for (in the RFQ column) and then enters a quantity in the Quantity column. They click request quote and it will be emailed away (at the moment just trying to echo it all out for testing). Im running into a really wierd issue when carrying over the quantities entered. It seems to be that if the Manufacturer detail is empty (from the Database), then the Quantity wont be posted - but the two arent related by any code? It works fine for all other parts? The main parts: // Display the reuslts that are found else { echo $NumberResults . ' matching parts found: <br />'; // Show the results table and build a new form echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<table border="1" align="center">'; echo '<tr>'; echo '<th>RFQ</th>'; echo '<th>Part Number</th>'; echo '<th>Manufacturer</th>'; echo '<th>Stock</th>'; echo '<th>Quantity</th>'; echo '<th>Delivery</th>'; echo '</tr>'; $tabindex = 8; while ($rows = mysql_fetch_array($query)) { echo '<tr>'; echo '<td><input type="checkbox" value="' . $rows['Part Number'] . '" name="RFQ[]"></td>'; echo '<td>' . $rows['Part Number'] . '</td>'; echo '<td>' . $rows['Manufacturer'] . '</td>'; echo '<td>' . $rows['Stock'] . '</td>'; echo '<td><input type="text" value="' . $_POST['Quantity'] . '" name="Quantity[' . $rows['Part Number'] . ']" tabindex="' . $tabindex++ .'" /></td>'; echo '<td><select name="Delivery" tabindex="' . $tabindex++ .'"> <option value="Any">Any</option> <option value="Emergency">Emergency</option> <option value="Next Day">Next Day</option> <option value="2-3">2-3 Days</option> <option value="4-6">4-6 Days</option> <option value="7-10">7-10 Days</option> <option value="10+">10+ Days</option> </select></td>'; echo '</tr>'; } echo '</table>'; echo $rows; // Send request for quotation echo '<input type="submit" name ="SendRFQ" value="Request Quotation">'; echo '</form>'; } and // Check if parts have been selected for quotation already if (isset($_POST['SendRFQ'])) { $RFQ = $_POST['RFQ']; $Quantity = $_POST['Quantity']; $NumberRFQ = count($RFQ); //$stripQuantity = array_filter($Quantity); //$resetQuantity = array_values($stripQuantity); print_r($RFQ); echo '<br />'; print_r($Quantity); echo '<br />'; // List parts selected for quotation if ($NumberRFQ>0) { echo 'RFQs chosen: '.$NumberRFQ.'<br /><br />'; echo 'You chose the following:<br /<br />'; echo '<table border="1" align="center">'; echo '<tr><th>Part Number</th>'; echo "<th>Quantity?</th></tr>"; for ($i=0; $i<$NumberRFQ; $i++) { echo '<tr>'; echo '<td>' . $RFQ[$i] . '</td>'; echo '<td>' . $Quantity[$RFQ[$i]] . '</td>'; echo '</tr>'; } echo "</table>"; echo '<br /><br />'; } else { echo 'No parts have been chosen for quotation<br /><br />'; echo '<a href="/search.php">Click here</a> to go back<br /><br />'; } } You can have a look for yourself here. Try searching for a 6202 (ignore all the contact details and delivery, just tick and enter a quantity), and selecting the three without a manufacturer - one comes back empty?! The rest are fine? Ive uploaded the whole script as well. I would really appreciate some help - ive completely hit a dead end and dont know where to go. Thanks a lot. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/204483-_posting-values-from-multidimensional-array-completely-suck-help-please/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.