Good Evening everyone.

I work for a marquee firm and i am creating a php mysql components list for the assistance for loading equipment.
SO far, the user can input a marquee size (eg: 6mx3m) in a form and we search the database and output the items required for said marquee size.

This is the code

<h2>Components List</h2>

<?php 

		if (isset($_POST['frame'])){
			
			$size  = $_POST['first'].'x'.$_POST['second'];
		
			
	
			echo "&nbsp; Components needed for a $size  are;";
			echo "<br />";
			
			$result = mysql_query("SELECT * FROM frames WHERE size='$size'",$conn);
			$row = mysql_fetch_array($result);
				echo "Legs: ";
				echo $row['legs'];
				echo "<br />";
				echo "Roof Beams: ";
				echo $row['roof-beams'];
				echo "<br />";
				echo "Middle Legs: ";
				echo $row['middlelegs'];
				echo "<br />";
				echo "Inner Purlins: ";
				echo $row['purlins'];
				echo "<br />";
				echo "Outer Purlins: ";
				echo $row['outer-purlins'];
				echo "<br />";
				echo "Fat Bars: ";
				echo $row['fat-bars'];
				echo "<br />";
				echo "Top Bars: ";
				echo $row['top-bars'];
				echo "<br />";
				echo "Bottom Bars: ";
				echo $row['bottom-bars'];
				echo "<br />";
				echo "Spiggots: ";
				echo $row['spiggots'];
				echo "<br />";
				echo "Base Plates: ";
				echo $row['base-plates'];
				echo "<br />";
				echo "Chains: ";
				echo $row['chains'];
				echo "<br />";
			
				
				
			
		}?>
	
    
    <form action="<?php $_SERVER['PHP_SELF'];?>" method="post">
    Frame Size<br />
    <input type="text" name="first" width="2" />&nbsp;x&nbsp;<input type="text" name="second" width="2" /><bR />
    <input type="submit" name="frame"  value="Get Components" />
    </form>

My aim and problem is if the user has three or four marquees to load how would i implement the forms and how, if possible, could the whole lot be added together so the output remains how it i now with all the components added together!

eg if the user wants a 6x3m frame tent he would need 4 legs but if he also needed a 6x6m he would need a further 6 making the output 10. Sounds complicated but i'm sure it is quite possible i'm just not sure on how to go about it!

Any help, pointers are always appreciated.
Regards
Chris

Recommended Answers

If the marquees are std sizes and there are only a few of them, you could have a quantity box next to each size label. Each textbox should have an id / name something like 'marquee_<?php echo $row;?>'.

In your post array you could then search the ids against …

Jump to Post

All 4 Replies

Member Avatar

If the marquees are std sizes and there are only a few of them, you could have a quantity box next to each size label. Each textbox should have an id / name something like 'marquee_<?php echo $row;?>'.

In your post array you could then search the ids against your db and then multiply the value by the db 'poles' value to get a total.

There is no standard size, there is a mixed variation of sizes.
It is just a method i am after or an idea of a method.

Cheers...

your going to need to have more than one option to input the H and W. Once you have that then make the inputs into an array and then loop through the array.

$sizes = array('5X4', '3X8', '2X6');

foreach($sizes as $current){
   // YOUR MYSQL STUFF HERE
}
Member Avatar

You need to extract the relevant records and multiply by the quantity of each and then sum the individual fields:

pseudocode:

(get the info from INNER JOIN sql - userorders and frames)

for each record...

$legs .= $row['legs'] * $quantity[$i];
$rbeams .= $row['roof-beams'] * $quantity[$i];
... etc ...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.