Hello, I am having a hard time getting a value sent to via POST. I have a PHP code which outputs this HTML: Please select your preferred ADMIN AREA language: <!-- beginning of admin language selector drop down menu //--> <form action="/?p=menuedit" method="post"> <script type="text/javascript">var url_full = "/?p=menuedit";</script> <img src="/images/flags_iso/24/us.png" style="position:relative;top:7px;" /> <select name="l_admin" OnChange="this.form.submit();window.location.href=url_full;"> <option value="en" selected>English</option> <option value="it">Italiano</option> </select> </form> <!-- end of admin language selector drop down menu //--> HTML: I also tried using just <form action="" method="post"> or even just <form method="post">. This form resides on the page /?p=menuedit (I am actually generating that part of the HTML with this PHP): echo '<form action="/?'.$_SERVER['QUERY_STRING'].'" method="post">'; PHP: At the top of the page, for the sake of testing it, I put: echo $_POST['l_admin']; PHP: But every time I submit the form I get: Notice: Undefined index: l_admin in /home2/memory/public_html/globals.inc.php on line 26 Code (markup): In other words, somehow it seems like my form is not submitting the post values... Can somebody help me figure out what I am doing wrong? Thanks a lot
remove these 2 lines from your code and it will work. 1. <script type="text/javascript">var url_full = "/?p=menuedit";</script> 2. window.location.href=url_full; You will still get the Notice error, but that won't effect your code.
The code echo '<form action="/?'.$_SERVER['QUERY_STRING'].'" method="post">'; PHP: is vulnerable to XSS, I'd strongly recommend switching to some alternative