How to use variables in hyperlink using asp.net -


i using php , asp.net pass variables on page using hyperlink. bit of code:

<h3><?php echo $product["01"]["model"]; ?></h3>     <div class="image_box">          <img src="images/product/01.jpg" alt="" />     </div>          <p><?php echo $product["01"]["brand"]; echo " "; echo $product["01"]["model"]; ?></p>     </div></a> 

so there image, brand , model displayed on first page. when clicks div, redirected new page called "product details" find of details of product they've clicked on. done asp.net (<a href="productdetail.aspx?brand=jori&model=icecube>). here, brand , model passed next page can use data.

but there way can replace <a href="productdetail.aspx?brand=jori&model=icecube> <a href="productdetail.aspx?brand=$product["01"]["brand"]&model=$product["01"]["model"]> example? don't have write brand , model every time them i've made them.

this how made products, in php:

$product = array(     "01" => array("brand" => "jori", "model" => "shiva"),                       "02" => array("brand" => "jori", "model" => "espalda"),                       "03" => array("brand" => "jori", "model" => "indy")); 

my php little rusty following loop should you.

<?php     foreach($product $p){ ?> <h3><?php echo $p["model"]; ?></h3> <div class="image_box">      <img src="images/product/<%php echo key($p); %>.jpg" alt="" /> </div>      <p><a href="productdetail.aspx?brand=<?php echo $p["brand"]; ?>&model=<?php echo $p["model"]; ?>"><?php echo $p["brand"]; echo " "; echo $p["model"]; ?></a></p> </div></a> <?php     } ?> 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -