I’m trying to create commenting system with multiple pages (each page has its own comments).
For example – two pages for visitors: alegro.php and darwin.php
alegro.php
<?php
$page="alegro"; // this variable should identify a page
include "comments.php";
?>
darwin.php
<?php
$page="darwin";
include "comments.php";
?>
comments.php has a commentForm and some js validation code.
Then comments.php send all to the fourth file – submit.php, which populates dbTable:
mysql_query("INSERT INTO comments(page,name,url,email,body) VALUES (
'$page' // - this is my first try
$page // - the second try
'".$arr['page']."' //the third try (after implementing a hidden "page" field into the form).
'".$arr['name']."',
'".$arr['url']."',
'".$arr['email']."',
'".$arr['body']."'
)");
Anyway – $page value is not written into the table.
darwin.php
comments.php
submit.php
FYI – don’t use mysql_* as it’s being deprecated. Switch to PDO or mysqli functions.