I mean, I’m trying the web link to look like something.com/newpage.php?id=123....
What I have is a form, and a JavaScript function on load that runs this AJAX:
$.ajax({
type: "POST",
url: "postear.php",
data: "addcontentbox=" + addcontent,
success: function() {
$("ul#wall").prepend("<li><a href='newpage.php?id=<?php echo $rows['id']; ?>' target='_blank'>"+addcontent+"</a></li>");
$("ul#wall li:first").fadeIn();
document.postbar_add_post.addcontent.value='';
$('form#postbar_add_post input[type="submit"]').removeAttr('disabled');
}
});
and this is the PHP function that is calls on the url:
<?php
if(isset($_POST['addcontent']))
{
// Connection to Database
include('config.php');
// No Query Injection
$message = mysql_real_escape_string($_POST['addcontent']);
// echo
$sql = 'INSERT INTO test.wall (message) VALUES("' . $message . '")';
$result = mysql_query($sql);
$rows = mysql_fetch_array($result);
mysql_query($sql);
echo $message;
}
else
{
echo '0';
}
?>
also, tried to place there a _GET [id].. but nothing.
Any help ?
pd:the dabase is:
CREATE TABLE `test`.`wall` (
`id` INT( 6 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`message` VARCHAR( 255 ) NOT NULL
) ENG
first u need to change this lines
to
and in the php file instead of this three lines
u should write
of course you have to set the id fild in the database to autoincrement first
it doesn’t hurt to change this
to
i mean it’s easier this way