Jump to content

Form not getting set with PHP all fields return empty


progwihz@yahoo.com

Recommended Posts

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

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

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.

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" >

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 ?

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.

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"

 

 

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.)

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.