Welcome Guest, Not a member yet? Register   Sign In
is it possible to add url with input form ?
#1

[eluser]ludo31[/eluser]
Hello I would like to know if it is possible to add url when we use input form :

before : I use this code :

Code:
<?php $segments = array('shop', 'produit',$r->libelle_genre,$r->libelle_style,$r->id ); ?>


                    
                       <a href="&lt;?php echo site_url($segments); ?&gt;"><br/>

          
            
                                &lt;?php  echo img('image/supplement/cart.png');?&gt;

                       </a>

but I would like to cnage it like this :

Code:
&lt;?php echo form_open('shop/produit'); ?&gt;
                    
                    
                    &lt;input type="hidden" name="genre" value="&lt;?php echo $r-&gt;libelle_genre ;?&gt;" /&gt;
  
                &lt;input type="hidden" name="style" value="&lt;?php echo $r-&gt;libelle_style ;?&gt;" /&gt;
  
  
                    &lt;input type="hidden" name="identifiant" value="&lt;?php echo $r-&gt;id ;?&gt;" /&gt;
  
                    &lt;input type="submit" value="Ajouter" /&gt;
                    
                    
                    
                    &lt;?php echo form_close();?&gt;

but my problem is url is just shop/produit

but before I have :

shop/produit/genre/style/id

and I would like to know if it is possible !!

thanks

#2

[eluser]Samus[/eluser]
I don't think it is, definately not possible with POST. You could get that URL with using GET though.

Only thing is you'd end up getting an url like:

shop/produit/?genre=genre_val&style=style_val&id=id_val

someone else might know.
#3

[eluser]ludo31[/eluser]
Thanks for you answer ;
you know why I ask this question because my problem is I would like to create a breadcrumb in my shopping cart file :

in my class Shop I have to function add(to add product) and panier

Code:
public function add() {

        /* on intercepete la quantitedisponible exemple 12 */

      
        
      //  $quantif = $this->uri->segment(8);
        
    

       // $identifiant = $this->uri->segment(5);
        
        
        $identifiant = $this->input->post('identifiant');
        
         /* on cherche la chaussure par identifiant
          * id , qty , prix , nom , et quantite
          *  */
        
         $data = $this->shopModel->getInfos($identifiant);
        

        /* parametre de la class cart
         * mettre en options la quantite disponible
         */


        foreach ($data as $key => $value) {
            
            $identif = $value->id ;
            $prix = $value->prix ;
            $nom = $value->nom ;
            $quantif=$value->quantite;
            $genre = $value->libelle_genre;
            $style = $value->libelle_style;
        }
        
        
        
      

        $panier = array(
            'id' => $identif,
            'qty' => 1,
            'price' => $prix,
            'name' => $nom,
            'options' => array('quantite' => $quantif)
        );

        
        
    
      
      
        
      


          /* insertion dans la cart */
        $this->cart->insert($panier);


        /* redirection vers la vue panier.php */
        
      //  $paniere = array('shop','panier',$genre,$style);

        redirect('shop/panier');
        
     // $this->load->view('shop/panier');
        
        
    }

    /* cette fonction vise a inserer le produit dans la classe cart */

    public function panier() {



        $data['content'] = 'shop/panier';
        $this->load->view('template/template', $data);
    }

and in my url when I execute that and shop/panier (view file )

Quote:http://localhost/MonSite/index.php/shop/panier
it's normal because I make
Code:
$data['content'] = 'shop/panier';

but I would like to change the url and add gender and shoes

something like that :

shop > panier > gender > shoes

that's why I ask you if it's possible to add url in this case !!

thanks
because in my breadcrumb there is just : shop > panier
#4

[eluser]Clooner[/eluser]
As I see it, it would be possible, why not? did you try it? Code seems fine to me!
#5

[eluser]ludo31[/eluser]
yes this code work well but in the url it show just :

panier > shop

not panier > shop > gender > baskets or example to do that we must add url




Theme © iAndrew 2016 - Forum software by © MyBB