<?php
$a="Added Successfully";
?>
<script>
function echoHello()
{
<?php hello(); ?>;
}
</script>
<?php
function hello()
{
mysql_query ("INSERT INTO `movies` (`movie_name`,`movie_added`) VALUES ('".mysql_real_escape_string($_POST['movie_name'])."',NOW())");
}
?>
<input type="text" name="movie_name" />
<button onclick="echoHello()">Add</button>
I have added this code into movies.php so that I could be able to add a title from this page. But, the text input box can't deliver the tiltle to the database, that is why when I click 'add', a new row is created but without any title. Even, a new row is created by every 'reload" of the page, I mean when I refresh this page, a new blank row is created.
I guess, the text input doesn't work because it's in POST method....but I have to use javascript here. So, can you please tell me how to make the input work?FHHDTP