Código PHP:
<?php require_once('../../../Connections/peticiones.php');
session_start();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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']);
}
$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 messages (pray_nombre, pray_apellido, pray_email, pray_telefono, pray_titulo, pray_peticion) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['pray_nombre'], "text"),
GetSQLValueString($_POST['pray_apellido'], "text"),
GetSQLValueString($_POST['pray_email'], "text"),
GetSQLValueString($_POST['pray_telefono'], "text"),
GetSQLValueString($_POST['pray_titulo'], "text"),
GetSQLValueString($_POST['pray_peticion'], "text"));
mysql_select_db($database_peticiones, $peticiones);
$Result1 = mysql_query($insertSQL, $peticiones) or die(mysql_error());
$insertGoTo = "peticiones.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!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>Centro de Fe y Esperanza Robledo</title>
<link rel="stylesheet" href="../../../css/iglesia/oracion/peticiones.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/nav.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/reset.css" type="text/css" media="screen"/>
<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald&v1' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<!--script para limitar caracteres en textarea-->
</head>
<body onLoad="limpiar();">
<div id="top_header_oracion">
<div class="nav_oracion">
<ul>
<li><a href="../../../index.html">inicio</a></li>
<li><a href="../../../html/iglesia/soynuevo.html">¿eres nuevo?</a></li>
<li><a href="../../../html/iglesia/conectate.html">conectate</a></li>
<li><a href="peticiones.php">oración</a></li>
<li><a href="../recursos/recursos.php">recursos</a></li>
<li><a href="../contacto/contacto.php">contacto</a></li>
</ul>
</div><!--final nav_index-->
</div><!--final top_header_oracion-->
<div class="back_contenido1"></div>
<div class="contenido1">
<div class="peticiones_box1">
<div class="peticiones_box_title"><p>peticiones |</p></div>
<div class="peticiones_box_subtitle"><img src="../../../img/iglesia/oracion/peticiones/pray_personal.jpg" /></div>
</div><!--final peticiones_box-->
<div class="peticiones_box2">
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
<div class="panel_secundario_title">Nombre:</div>
<div class="panel_secundario_title">Apellido:</div>
<div class="panel_secundario"><input type="text" name="pray_nombre" value="" size="32" /></div>
<div class="panel_secundario"><input type="text" name="pray_apellido" value="" size="32" /></div>
<div class="panel_secundario_title">e-mail:</div>
<div class="panel_secundario_title">Teléfono:</div>
<div class="panel_secundario"><input type="text" name="pray_email" value="" size="32" /></div>
<div class="panel_secundario"><input type="text" name="pray_telefono" value="" size="32" /></div>
<div class="panel_secundario_title" style="text-align:right;padding-top:15px;">Título de la Petición:</div>
<div class="panel_secundario"><input type="text" name="pray_titulo" value="" size="32" /></div>
<div class="panel_textarea_title">Petición o Necesidad:</div>
<div id="limit"></div>
<div class="panel_textarea"><textarea name="pray_peticion" cols="67" rows="12"></textarea></div>
<input type="submit" value="ENVIAR" class="panel_boton"/>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</div>
</div><!--final contenedor-->
<div class="back_contenido2"></div>
<script type="text/javascript" src="../../../js/iglesia/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../../js/iglesia/limit_caracter.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('textarea').limit('1000','#limit');
});
</script>
</body>
</html>