Es decir, quiero poder cambiar la image1 a picture, o la image2 a picture, con un checkbox. No sé que pasa que no funciona.
Dejo el codigo:
mostrarfotos.php:
Código PHP:
Ver original
<?php include("connect.php"); include("function.php"); $usuario=$_SESSION["usuario"]; $id=$_SESSION["id"]; if ($defaultphoto == 'on') { } if ($action == 'del') { $image1 = getimage1($id); $image2 = getimage2($id); $image3 = getimage3($id); if ($picture == 'img1') { if (($image1 != '') and ($image2 != '') and ($image3 != '')) { ()); } elseif (($image1 != '') and ($image2 != '') and ($image3 == '')) { } elseif (($image1 != '') and ($image3 != '') and ($image2 == '')) { } else { } } if ($picture == 'img2') { if (($image1 != '') and ($image2 != '') and ($image3 != '')) { ()); } elseif (($image1 != '') and ($image2 != '') and ($image3 == '')) { } else { } } if ($picture== 'img3') { if (($image1 != '') and ($image2 != '') and ($image3 != '')) { } elseif (($image1 != '') and ($image3 != '') and ($image2 == '')) { } else { } } } $defaultimg = $get_photo["picture"]; if ($get_photo["image1"] != '') { if ($get_photo["image1"] != $defaultimg) { } else { } } if ($get_photo["image2"] != '') { if ($get_photo["image2"] != $defaultimg) { } else { } } if ($get_photo["image3"] != '') { if ($get_photo["image3"] != $defaultimg) { } else { } } if ($get_photo["image3"] == "" or $get_photo["image2"] == "" or $get_photo["image1"] == "") { } ?>
despues al lado de cada foto pongo algo asi, para que me indique si es la imagen que tengo en el perfil, o es otra imagen que tengo esto en el mismo codigo, pero está dentro del html:
Código PHP:
Ver original
<?php if ($get_photo["image2"]!=$defaultimg) { ?> Mostrar en mi perfil <?php } else { ?> Mostrar en mi perfil como la imagen por defecto <?php }?>
Este es el editar_foto.php:
Código PHP:
Ver original
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include ("connect.php"); include ("function.php"); $id=$_SESSION["id"]; $usuario=$_SESSION["usuario"]; $picture=$getname["picture"]; $image1=$getname["image1"]; $image2=$getname["image2"]; $image3=$getname["image3"]; if ($picture == 'picture') { $cap = 1; $pic = 'pic'; $picture = getpicture($id); $caption = $getname["picture"]; }elseif($picture =='image1'){ if ($picture == 'image1') { $cap = 1; $img = 'img1'; $image1 = getimage1($id); $caption = $getname["image1"]; } elseif ($picture == 'image2') { $cap = 2; $img = 'img2'; $image2 = getimage2($id); $caption = $getname["image2"]; } else { $cap = 3; $img = 'img3'; $image3 = getimage3($id); $caption = $getname["image3"]; } } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Editar foto</title> <style type="text/css"> <!-- #Layer1 { position:absolute; left:155px; top:60px; width:557px; height:264px; z-index:1; } #Layer2 { position:absolute; left:155px; top:100px; width:80px; height:20px; z-index:2; } #Layer3 { position:absolute; left:244px; top:100px; width:422px; height:135px; z-index:3; } --> </style> </head> <body> <div id="Layer1"> <p>Editar foto</p> </div> <div id="Layer2">Default foto: </div> <div id="Layer3"> <form method=post action="misfotos.php"> <tr> <td class=body_txt bgcolor="#CCCCFF"></td> <td class="body_txt" bgcolor="#CCCCFF"> <?php if ($picture==getpicture($mid)) { ?> This is the default photo. To make a different photo the default click on<br>the <img src="images/edit_icon.gif" >icon to the right of the chosen photo. <?php } else { ?> <input name=defaultphoto type=checkbox> Make this photo the default when viewing my profile. <?php } ?> </td> <input type="hidden" name="photo" value=<?php echo $image;?>> <input type="submit" width="87" height="23"> </tr> </form> </div> </body> </html>
Gracias por leer.
den_22