How to check textarea value is submitted or not on insert page?
if (isset($share)){
//do stuff
}
or anything else?
I'm using click function #share instead form submit.
How to check #share is clicked, on insert.php page?
config.php
$host="localhost";
$user="";
$password="";
$db="";
$link = mysql_connect("$host", "$user", "$password");
$con=mysql_select_db("$db")or die(mysql_error());
index.php
<!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=iso-8859-1" />
<title>Wall Post</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.js"> </script>
<script type="text/javascript">
$(document).ready(function(){
$('#share').click(function(){
var status=$(".input").val();
var DATA = 'status=' + status;
$.ajax({
type: "POST",
url: "insert.php",
data: DATA,
success: function() {
//display message back to user here
}
});
return false;
});
});
</script>
</head>
<body>
<div class="status">
<textarea class="input" name="status" id="content" >So whats on your mind?</textarea>
</div>
<div class="button_outside" id="share">
<div class="button_inside">Share</div>
</div>
</body>
</html>
insert.php
<?php
include("config.php");
$status=$_POST["status"];
$query = "INSERT INTO streams (message) VALUES ('$status')";
mysql_query($query) or die(mysql_error());
?>