Hi
When i go onto my website and try and submit some data into my database it is not submitting and i do not know why. However i am very confident that the problem is somewhere in the following code:
If i have posted this in the wrong place then i apologise but i used my best judgement and decided to post it here, also if you need to see some more of my code then please feel free to ask and i shall provide more of it.
Thank You
When i go onto my website and try and submit some data into my database it is not submitting and i do not know why. However i am very confident that the problem is somewhere in the following code:
<div class='Map'>
<img src='http://n.vdsh.net/hosting/Dan/JWT/images/ets2_map.png'/>
<?
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="ed9e4afe98!"; // Mysql password
$db_name="DansDB"; // Database name
$tbl_name="DansMap"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql= "SELECT * FROM $tbl_name";
$Result = mysql_query($sql);
function getUser($ID)
{
$tbl_name2="jwtmembers"; // Table name
$User = "SELECT Name FROM $tbl_name2 WHERE id = $ID";
$UserQ = mysql_query($User);
$UserN = mysql_fetch_array($UserQ);
return $UserN[0];
}
while($row = mysql_fetch_array($Result))
{
echo "<div class='Marker' onmouseout='hideCommet(".$row['id'].")' onmouseover='ShowCommet(".$row['id'].")' style='left:".$row['x']."px;top:".$row['y']."px'></div>";
echo "<div id='".$row['id']."'onmouseout='hideCommet(".$row['id'].")' onmouseover='ShowCommet(".$row['id'].")' style='left:".$row['x'] ."px;top:".$row['y'] ."px' class='CommentD'><div class='ComUser'>".getUser($row['User'])."</div><div class='ComboxCom'>".$row['Comment']."</div></div>";
}
?>
</div>
<div class='Modal'>
Division: <input type="text" id="division"><br>
Truck: <input type="text" id="truck"><br>
Cargo: <input type="text" id="cargo"><br>
Departing from: <input type="text" id="departure"><br>
Destination: <input type="text" id="destination"><br>
<button onclick='Add2db()'>Submit</button>
<button onclick='closeMod()'>Close</button>
<div class='c'></div>
</div>
<!-- Toby Stuff End -->
<!-- Toby Stuff -->
<script>
<?
if($In == "1")
{
echo ""?>
var relativeX
var relativeY
$(".Map ").click(function(e){
relativeX = e.pageX - this.offsetLeft;
relativeY = e.pageY - this.offsetTop;
$(".Map").append("<div class='NMarker'></div>");
$(".NMarker").css("left",relativeX);
$(".NMarker").css("top",relativeY);
$(".Modal").show();
$(".Modal").css("left",relativeX +200);
$(".Modal").css("top",relativeY +10);
});
function Add2db()
{
var division = $("#division").val()
var truck = $("#truck").val()
var cargo = $("#cargo").val()
var departure = $("#departure").val()
var destination = $("#destination").val()
var Mod = $(".Modal").clone()
var Stuff
$(".Modal").html("<img src='http://n.vdsh.net/hosting/Resources/loaders/Loader1.gif' alt='loader'/>")
$.ajax
({
url: 'AddMarkerMap.php',
data:
{
division: division,
truck: truck,
cargo: cargo,
departure: departure,
destination: destination,
x:relativeX,
y:relativeY
},
type: 'post',
success: function(output)
{
Stuff = output;
if(output == "1")
{
$(".Modal").html(Mod)
$(".Modal").hide();
}
else if(output == "3")
{
alert("Username Blank")
}
else if(output == "4")
{
alert("No Username")
}
else
{
alert(output)
$(".Modal").hide();
}
}
})
}
<?"";
}?>
function closeMod()
{
$(".Modal").hide();
}
function ShowCommet(id)
{
$("#"+id).show()
}
function hideCommet(id)
{
$("#"+id).hide()
}
</script>
<!-- Toby Stuff End -->
</body>
</html>
If i have posted this in the wrong place then i apologise but i used my best judgement and decided to post it here, also if you need to see some more of my code then please feel free to ask and i shall provide more of it.
Thank You