Código PHP:
resultadoVer original
<form name='form1' method='post' action='sitio.php' enctype="multipart/form-data"> <table> <tr> <td colspan='2'><div align="left">Banner 1</div></td> </tr> <tr> <td colspan="2"><p> <input type='file' name='img1' size='55' id="img1"/> </p> </td> </tr> <tr> <td colspan="2">Banner 2</td> </tr> <tr> <td colspan="2"><input type='file' name='img2' size='55' id="img2"/></td> </tr> <tr> <td colspan="2">Banner 3</td> </tr> <tr> <td colspan="2"><input type='file' name='img3' size='55' id="img3"/></td> </tr> <tr> <td colspan="2">Banner 4</td> </tr> <tr> <td colspan="2"><input type='file' name='img4' size='55' id="img4"/></td> </tr> <tr> <td><input name="enviar" type='submit' id="enviar" value='enviar' /></td> </tr> </table> </form>
Código PHP:
problema:Ver original
<?php $img1 = $_POST['img1']; $img2 = $_POST['img2']; $img3 = $_POST['img3']; $img4 = $_POST['img4']; $numbanners = 4; //numero de banners que se rotarán $img[1] = $img1; $img[2] = $img2; $img[3] = $img3; $img[4] = $img4; } echo "<img src='$img[$random]'>"; ?>
Código PHP:
solucion? Ver original
Notice: Undefined index: img1 in C:\wamp\www\banner\sitio.php on line 3 Notice: Undefined index: img2 in C:\wamp\www\banner\sitio.php on line 4 Notice: Undefined index: img3 in C:\wamp\www\banner\sitio.php on line 5 Notice: Undefined index: img4 in C:\wamp\www\banner\sitio.php on line 6