Jump to content

Not a complex problem


riddhi

Recommended Posts

I am developing a range.php where the customer may shop within the specified price range. Some relavant part of the code is as follows:-

 

while ($record=mysql_fetch_array($res)){
			 	     	  	 
	   if($record['PD_PRICE'] >= $start && $record['PD_PRICE'] <= 

$end) 
	     {// Display the Product if within the Price Range 


	 	    if($record['PD_THUMBNAIL']){
	               $cat_image=$record['PD_THUMBNAIL'];
	        
			   if($cat_image){
	                    $cat_image = WEB_ROOT.'images/product/' . 

$cat_image; 
			    }// End If
	           else 
		                $cat_image = 

WEB_ROOT.'images/no-image-small.png';
		     	    
			    echo " <td width='75' align='left'><img 

src='$cat_image'>";
				echo "<td>$record[PD_NAME]</td>";
				echo "<td>$record[PD_PRICE]</td>";
		     }// End of Thumbnail IF
	     
              echo "<b>";   			   
	      echo "<td>$record[PD_DESCRIPTION]</td>";
		  echo "</b>";		  
	  	  echo "<img src= WEB_ROOT.'images/addToCart.gif'>";	


	}// ENDIF
}// End While

 

After every product is shown having matchin result, I want to add the

 

following code after the addToCart.gif image has been pressed

 

  $_GET['p']=$record['PD_ID'];    //set the product id

  addToCart();

 

but how will I get the product Id of the pressed button? please write a small to make it a bit more clear.

Link to comment
https://forums.phpfreaks.com/topic/48047-not-a-complex-problem/
Share on other sites

You mean you want to know what the product id is when someone selects to buy that product using a "Buy" button?

 

If so, then using individual forms for each product, you can create a hidden input

<input type="hidden" name="productid" value="<?php echo $record['PD_ID']; ?>" />

 

If not, then please explain further.

Link to comment
https://forums.phpfreaks.com/topic/48047-not-a-complex-problem/#findComment-235431
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.