Ir para conteúdo
Fórum Script Brasil
  • 0

Path da Imagem


Evandro Araujo

Pergunta

2 respostass a esta questão

Posts Recomendados

  • 0

<?php require_once('../Connections/loja.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 = $HTTP_SERVER_VARS['PHP_SELF'];

if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {

$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];

}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {

$insertSQL = sprintf("INSERT INTO produtos (id, id_categ, produto, descricao, imagem, valor, frete, promocao, exibir) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",

GetSQLValueString($HTTP_POST_VARS['id'], "int"),

GetSQLValueString($HTTP_POST_VARS['id_categ'], "int"),

GetSQLValueString($HTTP_POST_VARS['produto'], "text"),

GetSQLValueString($HTTP_POST_VARS['descricao'], "text"),

GetSQLValueString($HTTP_POST_VARS['imagem'], "text"),

GetSQLValueString($HTTP_POST_VARS['valor'], "text"),

GetSQLValueString($HTTP_POST_VARS['frete'], "text"),

GetSQLValueString(isset($HTTP_POST_VARS['promocao']) ? "true" : "", "defined","1","0"),

GetSQLValueString(isset($HTTP_POST_VARS['exibir']) ? "true" : "", "defined","1","0"));

mysql_select_db($database_loja, $loja);

$Result1 = mysql_query($insertSQL, $loja) or die(mysql_error());

}

?>

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

body {

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

background-color: #FFFFFF;

}

-->

</style>

<link href="css.css" rel="stylesheet" type="text/css" />

<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />

<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" /></head>

<body>

<table width="710" height="375" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td height="80" colspan="2" valign="top" bgcolor="#CCCCCC"><div align="left"><img src="imagens/logo.png" width="233" height="87" /></div></td>

</tr>

<tr>

<td width="94" valign="top"><ul id="MenuBar1" class="MenuBarVertical">

<li><a href="#">Home</a></li>

<li><a class="MenuBarItemSubmenu" href="#">Produtos</a>

<ul>

<li><a href="inc_produtos.php">Inclusao</a></li>

<li><a href="eproduto.php">Manuten&ccedil;&atilde;o</a></li>

</ul>

</li>

<li><a href="#" class="MenuBarItemSubmenu">Categoria</a>

<ul>

<li><a href="#">Untitled Item</a></li>

<li><a href="#">Untitled Item</a></li>

</ul>

</li>

<li><a class="MenuBarItemSubmenu" href="#">Config</a>

<ul>

<li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a>

<ul>

<li><a href="#">Item 3.1.1</a></li>

<li><a href="#">Item 3.1.2</a></li>

</ul>

</li>

<li><a href="#">Item 3.2</a></li>

<li><a href="#">Item 3.3</a></li>

</ul>

</li>

<li><a href="#">Usuario</a></li>

</ul></td>

<td width="1338" valign="top"><table width="580" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="580">&nbsp;</td>

</tr>

</table>

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">

<table width="286" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="78">Categoria</td>

<td width="472"><?php

//conecta ao servidor mysql

$link = mysql_connect("localhost","root","") or die ("Não foi possível conectar ao servidor");

//seleciona a base de dados

mysql_select_db("lojavirtual", $link)or die("Não foi possível selecionar a base de dados!");

//clausula sql

$sql = "SELECT * FROM categorias";

//executa a clausula sql

$result = mysql_query($sql)or die("Falha na execução da instrução SQL!");

//imprimir um campo select

echo "<select name=\"id_categ\" id=\"Id\">";

//faz o loop para preencher o campo criado com os valores retornados na consulta

while($dados = mysql_fetch_array($result))

{

$id_categ=$dados['id];

echo "<option value='".$id_categ."'>".$dados['nome']."</option>";

}

//fecha o campo select e o formulário

echo "</select>";

//fecha a conexão com o mysql

mysql_close($link);

?></td>

</tr>

<tr>

<td>Produto:</td>

<td><input type="text" name="produto" value="" size="32" /></td>

</tr>

<tr>

<td>Descricao</td>

<td>

<script type="text/javascript" src="../nicEdit.js"></script>

<script type="text/javascript">

bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });

</script>

<textarea name="descricao" cols="35"></textarea>

</td>

</tr>

<tr>

<td>Imagem</td>

<td><input type="file" name="imagem" id="imagem" size="32" /></td>

</tr>

<tr>

<td>Valor</td>

<td><input type="text" name="valor" value="" size="32" /></td>

</tr>

<tr>

<td>Frete</td>

<td><input type="text" name="frete" value="" size="32" /></td>

</tr>

<tr>

<td>Promocao</td>

<td><input type="checkbox" name="promocao" value="" /></td>

</tr>

<tr>

<td>Exibir</td>

<td><input type="checkbox" name="exibir" value="" /></td>

</tr>

<tr>

<td>&nbsp;</td>

<td><input type="submit" value="Inserir registro" /></td>

</tr>

</table> </td>

<input type="hidden" name="id" value="">

<input type="hidden" name="MM_insert" value="form1">

</form>

</tr>

<tr>

<td colspan="2">rodape</td>

</tr>

</table>

<script type="text/javascript">

<!--

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});

//-->

</script>

</body>

</html>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...