Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/09/2009, 15:16
roy488
 
Fecha de Ingreso: septiembre-2009
Ubicación: Pachuquita, Hidalgo
Mensajes: 13
Antigüedad: 14 años, 7 meses
Puntos: 0
formulario para que usuarios suban fotos

hola gente!

no se si alguien me pueda ayudar; sucede que estoy creando un sitio web donde tengo una seccion de clasificados.
ya cree mi base de datos y tengo mi enlace funcionando, pero quiero que el usuario pueda subir una imagen de lo que vende y no tengo ni la mas minima idea de como se hace; dejo mi codigo actual esperando que alguien me pueda ayudar!!!
lo estoy realizando con dreamweaver y mysq, no se mucho de esto asi q agradecere su ayuda!




<?php require_once('../Connections/directorio.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO anuncios_aviso_oportuno (nombre, apellidos, telefono, mail, municipios, categoria, titulo_anuncio, precio, descripcion, cond_uso, fecha) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, now())",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['telefono'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['municipio'], "text"),
GetSQLValueString($_POST['texto'], "text"),
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['precio'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString(isset($_POST['condiciones']) ? "true" : "", "defined","'Y'","'N'"));

mysql_select_db($database_directorio, $directorio);
$Result1 = mysql_query($insertSQL, $directorio) or die(mysql_error());

$insertGoTo = "aviso.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_directorio, $directorio);
$query_Recordset1 = "SELECT * FROM anuncios_aviso_oportuno";
$Recordset1 = mysql_query($query_Recordset1, $directorio) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC .........">
<head>
<link rel="shortcut icon" href="../icono.ico" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alta de anuncios.</title>
<link rel="stylesheet" type="text/css" href="s_alta_anuncios.css" /> <!-- hoja de estilos -->
<style type="text/css">
.Estilo1 {font-family: "FATboy Slim BLTC (BRK)"; font-size: 110px;}
.Estilo-input {font-family:"Century Gothic"; color:#FFFFFF; background-color:#666666; border:#666666}

body
{margin-right: 0cm;
margin-bottom: 40cm;}
</style>
</head>

<body onLoad="document.forms.form1.nombre.focus()">


<script language="Javascript"> <!-- verifica casillas -->
function Verifica(f){
if(form1.nombre.value == ''){
alert('debe introducir el nombre')
form1.nombre.focus()
return false
}
if(form1.apellido.value == ''){
alert('indroduzca sus apellidos')
form1.apellido.focus()
return false
}
if(form1.telefono.value == ''){
alert('Introduzca su telefono')
form1.telefono.focus()
return false
}
if(form1.mail.value == ''){
alert('Introduzca su e-mail')
form1.mail.focus()
return false
}
if(form1.municipio.value == ''){
alert('Introduzca su municipio de residencia')
form1.municipio.focus()
return false
}
if(form1.titulo.value == ''){
alert('Introduzca untitulo para su anuncio')
form1.titulo.focus()
return false
}
if(form1.precio.value == ''){
alert('Introduzca el precio solicitado')
form1.precio.focus()
return false
}
if(form1.descripcion.value == ''){
alert('Introduzca una breve descripcion de su producto')
form1.descripcion.focus()
return false
}
if(form1.texto.value == ''){
alert('Seleccione la categoria para publicar su anuncio')
return false
}
if (document.getElementById('condiciones').checked){
return true;
}
else
{
alert("El formulario no puede ser enviado si no acepta terminos y condiciones");
return false;
}
form1.submit()
}
</SCRIPT>


<script language="JavaScript">
function Pregunta1(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Autos y Motos<br>"
document.form1.texto.value = "autos"}
function Pregunta2(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Animales<br>"
document.form1.texto.value = "animales"}
function Pregunta3(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Venta y renta de inmuebles<br>"
document.form1.texto.value = "inmuebles"}
function Pregunta4(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Electronica, telefonia y computo<br>"
document.form1.texto.value = "computacion"}
function Pregunta5(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Deportes<br>"
document.form1.texto.value = "deportes"}
function Pregunta6(){
document.getElementById('pregunta').innerHTML = "Su anuncio sera publicado en: Otros<br>"
document.form1.texto.value = "otros"}
</script>

<div id="outer">
<div id="inner">
<div class="bgtext Estilo1"> aviso oportuno </div>
<div id="text1"><a>Sube tu anuncio.</a></div>
<div id="text14"><a href="aviso.html">MENU.</a></div>
<div id="text11">Llena el formulario para poder publicar tu anuncio.</div>


<form name="form1" action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data">
<div id="cab">Datos del anunciante.</div>
<div id="nom">Nombre: <input name="nombre" type="text" class="Estilo-input" size="40"/></div>
<div id="apell">Apellidos: <input name="apellido" type="text" class="Estilo-input" size="40" /></div>
<div id="tel">Telefono: <input name="telefono" type="text" class="Estilo-input" size="40" /></div>
<div id="mail">E-mail: <input name="mail" type="text" class="Estilo-input" size="40" /></div>
<div id="municipio">Municipio: <input name="municipio" type="text" class="Estilo-input" size="40" /></div>
<div id="cab2">Datos del anuncio.</div>
<div id="cat">Categoria:
<div id="pregunta">Su anuncio sera publicado en:</div>
<p>
<label><input name="GrupoOpciones1" type="radio" Onfocus="Pregunta1()" value="autos"/>
Autos y motocicletas</label>
<br />
<label><input type="radio" name="GrupoOpciones1" value="animales" Onfocus="Pregunta2()"/>Animales</label>
<br />
<label><input type="radio" name="GrupoOpciones1" value="casas" Onfocus="Pregunta3()"/>Venta y renta de inmuebles.</label>
<br />
<label><input type="radio" name="GrupoOpciones1" value="compu" Onfocus="Pregunta4()"/>electronica, Telefonia y computo.</label>
<br />
<label><input type="radio" name="GrupoOpciones1" value="ropa" onfocus="Pregunta5()" />Deportes.</label>
<br />
<label><input name="GrupoOpciones1" type="radio" onfocus="Pregunta6()" value="otros" checked="checked" />
otros</label>
<br />
</p>
</div>

<div id="titulo">Titulo del anuncio: <input name="titulo" type="text" class="Estilo-input" size="40" /></div>
<div id="precio">Precio: <input name="precio" type="text" class="Estilo-input" size="40" /></div>
<div id="descrip">Descripcion: <textarea name="descripcion" cols="50" rows="5" class="Estilo-input"></textarea></div>
<div id="foto">Adjuntar foto: </div>
<div id="cond">
<input name="condiciones" type="checkbox" value="" id="condiciones"/>Acepto terminos y condiciones de uso.</div>
<div id="terminos">
<textarea name="terminos" cols="80" rows="10" readonly="true">Términos y condiciones de uso:
</textarea></div>

<div id="boton"> <input name="Enviar" type="submit" class="Estilo-input" value="Enviar datos" onClick="return Verifica(this);"></div>
<div id="text23"> <input name="texto" type="text" class="Estilo-input" size="40" readonly="true" /></div>
<input type="hidden" name="MM_insert" value="form1">
</form>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>