I'm with a doubt,
I'm trying sending data to my database but it doesn't insert it them. How can i put them to send it?
index.php (script part):
<div id="wel">
<p id="title-call">Junta-te <font color="gray">a nós!</font></p><hr color="#c96308" noshadow />
<p id="subx">Percorre este mundo e torna-te o treinador número <font color="#c96308">UM</font>!</p>
</div>
<div id="loading"><br /></div>
<div id="warn2"><br /></div>
<div id="success"><br /></div>
<div id="subscribe">
<form id="sub" action="" method="POST" >
<input type="text" name="username" id="username" placeholder="Escreve aqui o teu Nome..." /><br />
<br />
<input type="text" name="email" id="email" placeholder="Escreve aqui o teu E-mail..." /><br /><br />
<input type="submit" id="submit" value="Subscrever" />
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#sub").submit(function() {
if($("#username").val()==""||$("#email").val()=="") {
$("#warn2").hide(36000);
$("#loading").css("display:inline");
$("#loading").html("<img src='images/ajax-loader.gif' width='1%' height='3%' /> A carregar...");
$("#loading").fadeIn(200);
$("#loading").fadeOut(200);
$("#warn2").css("display:none");
$("#warn2").html("Por favor escreve o teu nome e/ou email!<br />");
$("#warn2").hide(36000);
$("#warn2").fadeIn(1000);
$("#warn2").css("display:inline");
$("#warn2").fadeOut(7000);
}
else {
var s = $("#sub").serializeArray();
$.ajax({
url: "subscribe.php",
method: "POST",
data: s,
success: function() {
$("#success").css("display:none");
$("#success").hide(36000);
$("#loading").css("display:inline");
$("#loading").html("<img src='images/ajax-loader.gif' width='1%' height='3%' /> A carregar...");
$("#loading").fadeIn(200);
$("#loading").fadeOut(200);
$("#success").css("display:none");
$("#success").html("A tua subscrição foi efectuada com successo!");
$("#success").hide(36000);
$("#success").fadeIn(1000);
$("#success").css("display:inline");
$("#success").fadeOut(7000);
}
});
}
return false;
});
$("#MGa").click(function() {
$("#hidGames").css("display: inline");
$("#hidGames").fadeToggle(1000);
return false;
});
$("#MGa").mouseover(function() {
$("#arrow").html('<img src="images/arrow_wbm_hover.png" width="1%" height="1%" />');
});
$("#MGa").mouseout(function() {
$("#arrow").html('<img src="images/arrow.png" width="1%" height="1%" />');
});
$("#arrow").html('<img src="images/arrow.png" width="1%" height="1%" />');
});
</script>
subscribe.php :
<?php
include_once('db.php');
$username = $_POST["username"];
$email = $_POST["email"];
$date = date("Y-m-d h:i:s:A");
$sql = mysql_query("INSERT INTO subscribers VALUES('','$username','$email','$date')");
// mail function //
$to = $email;
$header = "From: info@wbm.pt";
$header. = "Content-Type: text/html;";
$subject = "Bem-vindo ao WBM!";
$body = "
Bem vindo ao WBM (World Basket Manager) <b>$username</b>,<br />
<br />
Sê o treinador número <i>UM</i> deste mundo de treinadores.<br />
- Cria a tua equipa;<br />
- Compra e Vende jogadores;<br />
- Calendário real;<br />
- Equipas Originais (NBA);<br />
- Estádios;<br />
- Forma as tuas próprias táticas;<br />
<br>
Tudo isto no mundo de treinadores de basquetbol!<br />
Lançamento da versão BETA:<br />
<b>Data prevísivel: <i>25 de Maio de 2014</i></b><br />
<br />
Muito Obrigado,<br />
<b>Equipa WBM</b>
<br />
<br />
<h6>Não responder a este e-mail!</h6>
";
// mail //
mail($to,$header,$subject,$body);
$rw = mysql_query("SELECT * FROM subscribers");
$rows = mysql_num_rows($rw);
if($rows!=0) {
$nrow = $rows;
}
else {
}
$to1 = "cell phone number";
$header1 = "From: 15030@wbm.pt";
$header1. = "Content-Type: text/play;";
$subject1 = "Bem-vindo ao WBM!";
$body1 = "
Têm $nrow que se subscreveram.
Muito Obrigado.
(Não responder a esta mensagem)
";
//sms to my cell phone //
mail($to1,$header1,$header1.,$subject1,$body1);
?>
db.php:
<?php
$connect = mysql_connect('localhost','root','');
mysql_select_db('subscribers');
?>
What can I do to this thing work guys?