Doubt passing parameters via form

-2

Doubt, I can not send the image.

Path: _img / _products / foto2-verde.png

<input type="radio" name="cor" id="verde" value="verde"> 

<img src="_img/_produtos/foto<?=$_POST['???']?>-<?=$_POST['cor']?>.png">

This last code has to be this: _img / _products / foto2-verde.png

The way it is, it works for me: _img / _products / photo ??? -verde.png     

asked by anonymous 22.02.2017 / 18:43

2 answers

0

So you're just saying that your id passed by post is undefined (does not exist), but this is normal because you're just passing 'color'

If you want to upload an image you will have to use an 'input' of type 'file' and then in php you will have to use $ _FILE ['TupleNameInputFile'], not to mention that you will have to use the attribute enctype with multipart / form-data value in your form

    
22.02.2017 / 19:07
0

I solved the problem, the solution is below:

Just add an input type hidden

<input type="hidden" name="numproduto" value="2">

And complement the display code:

<img src="_img/_produtos/foto<?=$_POST['numproduto']?>-<?=$_POST['cor']?>.png"
            class="img-thumbnail img-responsive">
    
22.02.2017 / 20:21