bueno explico cuando ingreso una fecha en formato dd-mm-aaaa me lo guarda perfectamente en my bd en formato aaaa-mm-dd(ya que con una funcion le cambio el formato),pero cuando quiero mostar la fecha me la muestra en aaaa-mm-dd
si alguien me puede ayudar o decir que estoy haciendo mal lo agradeceria
Código PHP:
Ver original<?php
include("conexion.php");
if (isset($_POST["guardar"])) {
if($_POST["guardar"]=="guardar")
{
$fecha=$_POST["fecha"];
$lafecha=$mifecha[2]."-".$mifecha[1]."-".$mifecha[0];
$sql="insert into fecha (CODIGO,FECHA) values (".$_POST["codigo"].",'".$lafecha."')";
{
echo "datos ingresado correctamente";
}
else
{
echo "error al insertar".$sql;
}
}
}
if (isset($_POST["codigo"])) {
if($_POST["codigo"]!="")
{
$sql="select * from fecha where CODIGO='".$_POST["codigo"]."'";
}
}
?>
Código HTML:
Ver original<form id="form1" name="form1" method="post" action=""> <table width="227" border="1" align="center"> <input name="codigo" type="text" id="codigo" value="<?php if (isset( $_POST["codigo"])) echo $_POST["codigo"] ?>" onchange="submit();"/>
<?php
$mifecha=explode("-", $lafecha);
$la2fecha=$mifecha[2]."-".$mifecha[1]."-".$mifecha[0];
?>
<td><input name="fecha" type="text" id="fecha" value="<?php if (isset($guardar["FECHA"])) { echo $la2fecha;}?>"/>
</td> <input name="guardar" type="submit" id="guardar" value="guardar" />