Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get $_POST values (php, html)
    primarykey
    data
    text
    <p>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.</p> <p>index.php</p> <pre><code>print_r($_POST); //Returns nothing, tried other ways too //lot's of variables being defined include 'sql_data_handlers.php'; //instantiating some things </code></pre> <p>sql_data_handlers.php</p> <pre><code>//some functions retrieving data from sql db and finally: include($DOCUMENT_ROOT . "page.html"); </code></pre> <p>page.html</p> <pre><code>//html stuff &lt;?php //Some conditions include($DOCUMENT_ROOT . "comment_form.html"); ?&gt; </code></pre> <p>comment_form.html</p> <pre><code>&lt;form action="index.php" name="comment_form" id="comment_form" method="post"&gt; &lt;input type="text" name="name" value="Anonymous" required&gt;&lt;br&gt; //lot's of inputs &lt;input type="submit"&gt; &lt;/form&gt; </code></pre> <p></p> <p>I used to have <code>action="send_comment.php"</code> but I realized it could be turned into a function so I ctrl+c and adapted <code>send_comments.php</code> to a function on <code>sql_data_handlers.php</code>. The problem is, now I can't get the <code>$_POST</code> values on <code>index.php</code> to use in the function on <code>sql_data_handlers.php</code> (which is included in <code>index.php</code>).</p> <p>I would use <code>action="my_php_function_from_data_handlers.php($args)"</code> if it was possible, but I guess it isn't. btw, I already tried <code>action=""</code>. 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.</p> <p>Complete source of all files (pretty big, still working on it): <a href="http://pastebin.com/2nRuCpNx" rel="nofollow">http://pastebin.com/2nRuCpNx</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload