This is pretty weird. I have tried everything. I see no notable issue here. Thought, may be either of you could lend me a helping hand in this issue. I am badly stuck here.
When I press the submit button in the form below, no data is sent. I am made sure that I did not miss the name attribute, but I totally do not understand the issue.
var_dump($_POST)
array empty
The most interesting part of this error is, if I set the method to GET, the values are passed.
var_dump($_GET);
GET Method Result:
array
'song_file' => string '19 Jillian.m4a' (length=14)
'song_name' => string 'Jillian' (length=7)
'singer_name' =>
array
0 => string 'Heitor Pereira' (length=14)
1 => string '' (length=0)
2 => string '' (length=0)
3 => string '' (length=0)
4 => string '' (length=0)
5 => string '' (length=0)
'lang' =>
array
0 => string '2' (length=1)
'allow_downloading' => string 'yes' (length=3)
'add_song' => string 'Add' (length=3)
The form code is as below. Here, I tried out with post method.
<form class="form" action="" enctype="multipart/form-data" method="post">
<fieldset>
<div class="row">
<label class="label" for="song-file">Please select a track to upload*</label>
<input id="song-file" name="song_file" class="field" type="file" />
</div>
<div class="row">
<label class="label" for="song-name">Song Name :</label>
<input id="song-name" name="song_name" class="field" type="text" size="42" />
</div>
<div class="row">
<label class="label">Artists :</label>
<div class="field-row">
<input name="singer_name[]" class="field" type="text" size="25" />
<input name="singer_name[]" class="field" type="text" size="25" />
</div>
<div class="field-row">
<input name="singer_name[]" class="field" type="text" size="25" />
<input name="singer_name[]" class="field" type="text" size="25" />
</div>
<div class="field-row">
<input name="singer_name[]" class="field" type="text" size="25" />
<input name="singer_name[]" class="field" type="text" size="25" />
</div>
</div>
<div class="row">
<label class="label" for="allow-downloading"> Allow Downloading</label>
<select name="allow_downloading" class="dropdown">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
<input type="submit" name="add_song" value="Add" class="btn" style="float:none;" />
</fieldset>
</form>
As per the suggestion, here is a snippet of my PHP Code that this form uses:
P.S. I am using Code Igniter at the backend. All other forms are working well, expect for this one.
class Song extends CI_Controller {
public function add($album_id){
if($_POST){
var_dump($_POST);
}
$this->load->view('album/form.php');
}
}
Any help will be highly appreciated.