It's been a long time since I don't post here, even forgot my username. Sorry if this is the wrong section.
I can't get the $_POST['name'] values sent from an html form on my php file. I've seen lots of similar questions but nothing helped. I have lot's of includes so I believe it's a scope issue, but I can't figure it out.
print_r($_POST); //Returns nothing, tried other ways too //lot's of variables being defined include 'sql_data_handlers.php'; //instantiating some things
//some functions retrieving data from sql db and finally: include($DOCUMENT_ROOT . "page.html");
//html stuff <?php //Some conditions include($DOCUMENT_ROOT . "comment_form.html"); ?>
<form action="index.php" name="comment_form" id="comment_form" method="post"> <input type="text" name="name" value="Anonymous" required><br> //lot's of inputs <input type="submit"> </form>
I used to have action="send_comment.php" but I realized it could be turned into a function so I ctrl+c and adapted send_comments.php to a function on sql_data_handlers.php. The problem is, now I can't get the $_POST values on index.php to use in the function on sql_data_handlers.php (which is included in index.php).
I would use action="my_php_function_from_data_handlers.php($args)" if it was possible, but I guess it isn't. btw, I already tried action="". This may seem pretty messy but this way I only need one .html for the site layout, pages are on the sql and the .php files do all the job.
Complete source of all files (pretty big, still working on it, new to php too): http://pastebin.com/2nRuCpNx