progwihz@yahoo.com Posted August 13, 2008 Share Posted August 13, 2008 Hi all, What is wrong with this form ? None of the form values are getting set via isset. They are all empty. e.g. if(isset($_POST['addVideoGameId'])) { print_r($_POST); //this prints nothing } The form is below <form class="appnitro" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF');?>" name="addVideoGameForm" method="post" > <ul > <li class="form-li" id="li_1" > <label class="description" for="gameTitle">Game Title *</label> <div> <input id="gameTitle" name="gameTitle" class="element text large" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_1"><small>Please provide the title for this video game.</small></p> </li> <li class="form-li" id="li_2" > <label class="description" for="gameDesc">Game Description *</label> <div> <textarea id="gameDesc" name="gameDesc" class="element textarea medium"></textarea> </div><p class="guidelines" id="guide_2"><small>Please provide the overview of plot and gameplay</small></p> </li> <li class="form-li" id="li_3" > <label class="description" for="releaseDate">Release Date *</label> <span> <input id="releaseDay" name="releaseDay" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="releaseDay">DD</label> </span> <span> <input id="releaseMonth" name="releaseMonth" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="releaseMonth">MM</label> </span> <span> <input id="releaseYear" name="releaseYear" class="element text" size="4" maxlength="4" value="" type="text"> <label for="releaseYear">YYYY</label> </span> <span id="calendar_3"> <img id="cal_img_3" class="datepicker" src="images/calendar.gif" alt="Pick a date."> </span> <script type="text/javascript"> Calendar.setup({ inputField : "releaseDate", baseField : "element_3", displayArea : "calendar_3", button : "cal_img_3", ifFormat : "%B %e, %Y", onSelect : selectEuropeDate }); </script> <p class="guidelines" id="guide_3"><small>Please provide the release date for this video game.</small></p> </li> <li class="form-li" id="li_7" > <label class="description" for="element_7">Genre *</label> <div> <select class="element select large" id="element_7" name="element_7"> <option value="" selected="selected">Select a Genre</option> </select> </div><p class="guidelines" id="guide_7"><small>Please select the appropriate genre for this game.</small></p> </li> <li class="form-li" id="li_8" > <label class="description" for="element_8">Platform *</label> <div> <select class="element select large" id="element_8" name="element_8"> <option value="" selected="selected">Select a Platform</option> </select> </div><p class="guidelines" id="guide_8"><small>Please select the platform for this game.</small></p> </li> <li class="form-li" id="li_4" > <label class="description" for="publisher">Publisher </label> <div> <input id="publisher" name="publisher" class="element text large" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_4"><small>Provide the publisher details</small></p> </li> <li class="form-li" id="li_5" > <label class="description" for="developer">Developer </label> <div> <input id="developer" name="developer" class="element text large" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_5"><small>Please provide the game developer details</small></p> </li> <li class="form-li" id="li_6" > <label class="description" for="element_6">Cover Art (Box Art) *</label> <div> <input id="element_6" name="element_6" class="element file" size="40" type="file"/> </div> <p class="guidelines" id="guide_6"><small>Please upload a cover (box art) for this game.</small></p> </li> <li class="buttons"> <input type="hidden" name="form_id" value="77214" /> <input type="submit" class="button_text" id="addVideoGameId" name="addVideoGame" value="Submit Game" /> </li> </ul> </form> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/ Share on other sites More sharing options...
sasa Posted August 13, 2008 Share Posted August 13, 2008 change if(isset($_POST['addVideoGameId'])) { print_r($_POST); //this prints nothing } to if(isset($_POST['addVideoGame'])) { print_r($_POST); //this prints nothing } Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615323 Share on other sites More sharing options...
ignace Posted August 13, 2008 Share Posted August 13, 2008 if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'GET') { print_r($_POST); } Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615328 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 change if(isset($_POST['addVideoGameId'])) { print_r($_POST); //this prints nothing } to if(isset($_POST['addVideoGame'])) { print_r($_POST); //this prints nothing } Used isset($_POST['addVideoGame'] still the from prints nothing Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615339 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'GET') { print_r($_POST); } This is starnge. Used the example above but still nothing is getting printed or set. All other forms are working but am very very curious as to why this from is not getting set. Am reading stuffs on the internet regarding froms not getting set when they contain file upload fields. Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615343 Share on other sites More sharing options...
DoddsAntS Posted August 13, 2008 Share Posted August 13, 2008 there is an error in the following line. <form class="appnitro" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF');?>" name="addVideoGameForm" method="post" > it should be <form class="appnitro" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" name="addVideoGameForm" method="post" > Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615347 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 there is an error in the following line. <form class="appnitro" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF');?>" name="addVideoGameForm" method="post" > it should be <form class="appnitro" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" name="addVideoGameForm" method="post" > Typo has been fixed. Still form will not set. Anyone tried the form above with a php isset ? Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615361 Share on other sites More sharing options...
PFMaBiSmAd Posted August 13, 2008 Share Posted August 13, 2008 Please post all the actual code on the page. The form and the bit of if() .... print_r() code works. The code that ignace posted will indicate if the form is submitted and the post_max_size setting has been exceeded (you would get an empty "array()" displayed.) So, something your actual code is doing is causing likely causing the problem. Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615372 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 Thats all the code I got. I just dumped everything into a page called test.php I am just trying to see why the form issnt setting. I think its got to do with the fact that its got enctype="multipart/form-data" Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615389 Share on other sites More sharing options...
PFMaBiSmAd Posted August 13, 2008 Share Posted August 13, 2008 Even with uploads turned off in php.ini, the posted code works (form field values, at least the first one that I typed something in, shows up in the $_POST array.) Show your current code and show exactly what the output is (and if it is a blank page, where does the "view source" in your browser show.) Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615395 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 The form shows up ok in the test page. its just the fact that when I hit the submit button the print_r($_POST) is empty. Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615400 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 I am getting "Array ( ) " from print_r($_POST) Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615403 Share on other sites More sharing options...
PFMaBiSmAd Posted August 13, 2008 Share Posted August 13, 2008 I'll assume that is using the code ignace posted since you did not post your current code. The most likely reason has already been given - The code that ignace posted will indicate if the form is submitted and the post_max_size setting has been exceeded (you would get an empty "array()" displayed.) Either your are uploading a file that is larger than the post_max_size setting or the post_max_size setting is set incorrectly and is actually a very small value. A) Are you selecting an file in the upload field and what size is it relative to the post_max_size setting on your server, and B) Show us what the a phpinfo(); statement shows for the post_max_size setting. Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615409 Share on other sites More sharing options...
progwihz@yahoo.com Posted August 13, 2008 Author Share Posted August 13, 2008 Thanks to all. I decided to restart the apache server after some changes to the php.ini file and it now works ok. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/119442-form-not-getting-set-with-php-all-fields-return-empty/#findComment-615485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.