Question is not new but i can't make it work.I have registration form along with user registration form i also have a upload picture options.These are views
// view for user data
<form action="<?php echo base_url('Camping_register/register') ?>" method="post">
<h2>Camping <span class="red"><strong>Rent Details</strong></span></h2>
<label for="business_name">Business Name</label>
<input type="text" id="business_name" name="business_name" placeholder="enter your business name">
<label for="rental_description">Rental Description</label>
<textarea type="text" id="rental_description" name="rental_description"></textarea>
<button type="submit" name="submit">REGISTER</button>
<?php
$message = $this->session->flashdata('msg');
if($message){
echo '<div id="error_text">' . '<strong>'.$message .'</strong>'. '</div>';
}
?>
</div>
</div>
</div>
//view for image upload
<div class="register-container container">
<div class="row">
<div class="iphone span5">
<h4>Select files from your computer(For Camping)</h4>
<div class = "upload-image-messages"></div>
<?php echo form_open_multipart('upload/do_upload', array('class' => 'upload-image-form'));?>
<div class="form-inline">
<div class="form-group">
<input type="file" name="uploadfile[]" accept = "image/*" multiple = "multiple" size="20" /> <br />
</div>
<button type="submit" value="upload" class="btn btn-sm btn-primary" name="submit">Upload files</button>
</div>
<script>
jQuery(document).ready(function($) {
var options = {
beforeSend: function(){
// Replace this with your loading gif image
$(".upload-image-messages").html('<p><img src = "<?php echo base_url() ?>img/images.png" class = "loader" /></p>');
},
complete: function(response){
// Output AJAX response to the div container
$(".upload-image-messages").html(response.responseText);
$('html, body').animate({scrollTop: $(".upload-image-messages").offset().top-100}, 150);
}
};
// Submit the form
$(".upload-image-form").ajaxForm(options);
return false;
});
</script>
</form>
as we can see i have different controllers.
So i need when user click on register all the data along with image name is saved in database.I don't want to add upload button along with image form.
this is my image upload.php controller
http://pastebin.com/JcxpwTGv
We can find many tutorials form uploading user data or only images but no where we can find for submitting form as whole.