Link to home
Start Free TrialLog in
Avatar of Jazzy 1012
Jazzy 1012

asked on

Allow the whole div to submit form not just button

I have this code:
			<form method="get" action= "../menu-option" class= "flex">
				<span class="deliveryItem pointer vertical-top textCenter
				<?php if($filter[0] == 'Y'){echo "vegan ";}
				if($filter[1] == 'Y'){echo "vegetarian ";}
				if($filter[2] == 'Y'){echo "pescetarian ";}
				if($filter[3] == 'Y'){echo "dairy-free ";}
				if($filter[4] == 'Y'){echo "egg-free ";}
				if($filter[5] == 'Y'){echo "fish-free ";}
				if($filter[6] == 'Y'){echo "shellfish ";}
				if($filter[7] == 'Y'){echo "tree ";}
				if($filter[8] == 'Y'){echo "peanut ";}
				if($filter[9] == 'Y'){echo "soy ";}
				if($filter[10] == 'Y'){echo "total-fat ";}
				if($filter[11] == 'Y'){echo "saturated-fat ";}
				if($filter[12] == 'Y'){echo "cholesterol ";}
				if($filter[13] == 'Y'){echo "sodium ";}
				if($filter[14] == 'Y'){echo "protein ";}
				if($filter[15] == 'Y'){echo "calories ";}
				?>">
				<?php echo '<input type="hidden" name="meal_id" value="'.$meal_id1.'">';?>
				 <img src="<?php echo $image1; ?>" width="280px" height= "200px;" class="foodImage">
				<div class="menuDelivery">
				<h3 class= "textCenter OldStandard dark-orange font1"> <?php echo $name1;?> </h3>
				<p class= "OldStandardItalic text-black font2 vertical1"> <?php echo $subtitle1;?> </p>
				<hr>
				<span class="open_sanssemibold text-black">
				<?php	if(count($prices1) > 1){print_r($firstEle ." - ". $lastEle);}
				else{ print_r($price1);}
				?>
				<br>
				</span>
				<span class="text-black font2">
				<?php 	
				$counter = 0;
				if(mysqli_num_rows($result_meal_option) > 1)
				while ($row_meal_option = mysqli_fetch_assoc($result_meal_option)) {
				    $counter ++;
                    		$q_filters = "select * from main_filters where meal_options_id = '{$row_meal_option['id']}'";
                    		$result_filters = mysqli_query($conn,$q_filters);
                    		 $row_filterd= mysqli_fetch_assoc($result_filters);
                    		 
                    		 
                    		 
                    		 ?>
                    		 
                    		 <span class="deliveryItem1 
                    		 <?php 
                    		 if($row_filterd["vegan"] == 'Y'){echo "vegan ";}
                    		 if($row_filterd["vegetarian"] == 'Y'){echo "vegetarian ";}
                    		 if($row_filterd["pescatarian"] == 'Y'){echo "pescetarian ";}
                    		 if($row_filterd["dairy-free"] == 'Y'){echo "dairy-free ";}
                    		 if($row_filterd["egg-free"] == 'Y'){echo "egg-free ";}
                    		 if($row_filterd["fish-free"] == 'Y'){echo "fish-free ";}
                    		 if($row_filterd["shellfish-free"] == 'Y'){echo "shellfish ";}
                    		 if($row_filterd["tree nut-free"] == 'Y'){echo "tree ";}
                    		 if($row_filterd["peanut-free"] == 'Y'){echo "peanut ";}
                    		 if($row_filterd["soybean-free"] == 'Y'){echo "soy ";}
                    		 if($row_filterd["low-total-fat"] == 'Y'){echo "total-fat ";}
                    		 if($row_filterd["low-saturated-fat"] == 'Y'){echo "saturated-fat ";}
                    		 if($row_filterd["low-cholesterol"] == 'Y'){echo "cholesterol ";}
                    		 if($row_filterd["low-sodium"] == 'Y'){echo "sodium ";}
                    		 if($row_filterd["protein(25g)"] == 'Y'){echo "protein ";}
                    		 if($row_filterd["calories(450)"] == 'Y'){echo "calories ";}
                    		 
                    		 ?>
                    		 
                    		 ">
                    		 <?php 
                    		 //print_r($row_filterd);die;
                    		 echo($counter>1 ? "| ":""). $row_meal_option['label']. "</span>";
			            }  ?>
				
				<br>
				</span>
				<button type="submit" class="view white cbtn1 open_sansbold check_menu">View/Add</button>
				</div>
				</span>
				</form>

Open in new window


it now sends my meal_id to the meal_option page when I click "View/Add" How can I make my whole div clickable and when it is clicked, it takes me to the same place (a.k.a submits my form)
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial