I'm working on a page for editing user profiles but I want the page am working on to submit to itself when it is submitted and show a message that the profile has been edited successfully. Please how do I do this ?
Here is what am working ?
<div class="row">
<div class="text-center title">Pricing</div>
<div class="text-center desc col-md-8 col-md-push-2">
{{$sitename}}
</div>
<div class="container" style="padding-top: 60px;">
<h1 class="page-header">Edit Profile</h1>
<div class="row">
<!-- left column -->
<form class="form-horizontal" role="form" method="post" action="/profile">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="text-center">
<img id="ShowImage" src="#"/>
<img src="http://localhost:8234/img/index.png" class="avatar img-circle img-thumbnail" alt="avatar" width="200" height="200">
<h6>Upload a different photo...</h6>
<input type="file" class="text-center center-block well well-sm" name="avatar_path" id="avatar_path" onchange="readURL(this);">
</div>
</div>
<!-- edit form column -->
<div class="col-md-8 col-sm-6 col-xs-12 personal-info">
<div class="alert alert-info alert-dismissable">
<a class="panel-close close" data-dismiss="alert">×</a>
<i class="fa fa-coffee"></i>
This is the <strong>Profile Page</strong>. Use this to <strong>ONLY</strong> change your peronsal details
</div>
<h3>Personal info</h3>
<input class="form-control" value="{{$userInfo['data']['id']}}" type="hidden" name="user_id">
<div class="form-group">
<label class="col-lg-3 control-label">First Name:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['first_name']}}" type="text" name="first_name">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Last Name:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['last_name']}}" type="text" name="last_name">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Username:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['username']}}" type="text" name="username">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email Address:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['email']}}" type="text" name="email">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Gender</label>
<div class="col-lg-8">
<div class="ui-select">
<select id="gender" class="form-control" name="gender">
<option value="{{$userInfo['data']['profile']['gender']}}" selected>{{$userInfo['data']['profile']['gender']}}</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">City:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['city']}}" type="text" name="city">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">State:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['state']}}" type="text" name="state">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Country:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['country']}}" type="text" name="country">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Mobile:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['mobile']}}" type="text" name="mobile">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Occupation:</label>
<div class="col-lg-8">
<input class="form-control" value="{{$userInfo['data']['profile']['occupation']}}" type="text" name="occupation">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input class="bkgrnd-blue text-white btn btn-primary" value="Update Profile" type="submit">
<span></span>
Cancel
</div>
</div>
</form>
</div>
</div>
</div>
This solution came from https://laravel.io/forum/01-30-2015-form-submission-to-the-same-page. Hope it helps
I have done a get route to display the page. I then did route a post to post form data.
Then I passed the $data variable to blade where I did an isset to check if it is created which displays the results
Display initial page
public function destinationSearchGet(){
$headData = array('pageTitle' => 'Admin Home - View all destinations');
return view('admin.destination_search', $headData);
}
post data back to the same page and create a new variable
public function destinationSearchPost(){
$headData = array('pageTitle' => 'Admin Home - Search results');
$formData = Request::input('destination');
$data = ParentRegionList::destinationSearch($formData);
return view('admin.destination_search', $headData)->with(compact('data'))
}
use blade to check if it exists
#if (isset($data))
<p>{{dd($data)}}</p>
#endif
Related
I am using Metronic Form Repeater in our project.
My form tag doesn't have any encryption or content type.
<form class="m-form" action="<?php echo $action; ?>" method='POST'></form>
When I submit the form, I can see our data like below
Unfortunately, when I print the $_POST, I see an empty array.
Form Code
<div class="form-group m-form__group row" id="m_repeater_1">
<div data-repeater-list="" class="col-lg-12">
<div data-repeater-item class="form-group m-form__group row align-items-center">
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Column Name</label>
</div>
<div class="m-form__control">
<input type="name" name="col_name" class="form-control m-input" placeholder="Enter full name">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-4">
<div class="m-form__group m-form__group--inline">
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">Data Type</label>
<div class="col-lg-6 col-md-9 col-sm-6">
<select class="form-control m-select2" id="m_select2_1" name="param">
<option value='TINYINT'>TINYINT</option>
<option value='SMALLINT'>SMALLINT</option>
<option value='MEDIUMINT'>MEDIUMINT</option>
</select>
</div>
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Length</label>
</div>
<div class="m-form__control">
<input type="number" name="col_long" class="form-control m-input" placeholder="Uzunluk Giriniz">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="form-group m-form__group col-md-3">
<label for="exampleSelect1">Default</label>
<select class="form-control m-input" id="exampleSelect1" name="col_def">
<option value='1'>NoDefault</option>
<option value='2'>NULL</option>
<option value='3'>CURRENT_TIMESTAMP</option>
<option value='4'>ON UPDATE CURRENT_TIMESTAMP</option>
<option value='5'>AUTO_INCREMENT</option>
</select>
</div>
</div>
</div>
</div>
I am trying to create a short code for html form. because I want to use this multiple time in my word-press page.
I have no idea how to do this . if any help please let help me
<form action="<?php echo get_page_link(2599) ?>" method="POST" >
<input type='hidden' name='page_id' value='2599'>
<div class="row">
<div class="form-group col-sm-3 col-md-2" id="bgform_text2">
<h4>SEARCH</h4>
<p>For Your Favourite Place</p>
</div>
<div class="form-group col-sm-5 col-md-2">
<label>Where to ? </label>
<input type="text" name="names" class="input-text full-width" placeholder="start typing here....">
</div>
<div class="form-group col-sm-5 col-md-4">
<div class="row">
<div class="col-xs-6">
<label>Arrive </label>
<div class="controls">
<input type="text" name="arive_time" id="departing">
</div>
</div>
<div class="col-xs-6">
<label>Departs </label>
<div class="controls">
<input type="text" name="depart_time" id="returning">
</div>
</div>
</div>
</div>
<div class="form-group col-sm-9 col-md-2">
<label>Sleeps </label>
<div class="controls">
<i class="fa fa-sort"></i>
<select name="sleeps">
<option value="" disabled="" selected=""></option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></option>
</select>
</div>
</div>
<div class="form-group col-sm-3 col-md-2">
<input type="submit" value="submit" name="submit_btn" class="button">
</div>
</div>
</form>
Try this.
<?php
function my_shortcode(){
$pagelink = get_page_link(2599);
return '<form action="'.$pagelink.'" method="POST" >
<input type="hidden" name="page_id" value="2599">
<div class="row">
<div class="form-group col-sm-3 col-md-2" id="bgform_text2">
<h4>SEARCH</h4>
<p>For Your Favourite Place</p>
</div>
<div class="form-group col-sm-5 col-md-2">
<label>Where to ? </label>
<input type="text" name="names" class="input-text full-width" placeholder="start typing here....">
</div>
<div class="form-group col-sm-5 col-md-4">
<div class="row">
<div class="col-xs-6">
<label>Arrive </label>
<div class="controls">
<input type="text" name="arive_time" id="departing">
</div>
</div>
<div class="col-xs-6">
<label>Departs </label>
<div class="controls">
<input type="text" name="depart_time" id="returning">
</div>
</div>
</div>
</div>
<div class="form-group col-sm-9 col-md-2">
<label>Sleeps </label>
<div class="controls">
<i class="fa fa-sort"></i>
<select name="sleeps">
<option value="" disabled="" selected=""></option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></option>
</select>
</div>
</div>
<div class="form-group col-sm-3 col-md-2">
<input type="submit" value="submit" name="submit_btn" class="button">
</div>
</div>
</form>';
}
add_shortcode('my_shortcode_name','my_shortcode');
?>
you can use this shortcode in your page
<?php echo do_shortcode('[my_shortcode_name]');?>
I think you are saying that you do not want to copy-paste the exact same code on multiple places inside your project, PHP has an include control structure method to take any file and use the contents on run-time.
Your code could eventually look something like this:
# form definition inside the main page that needs the form
<form action="<?php echo get_page_link(2599) ?>" method="POST" >
# include the template
<?php include('template.php') ?>
</form>
# template.php contains the html form
<input type='hidden' name='page_id' value='2599'>
I want to create a login form to log system in php. But I can't do it, below I mentioned my code. I have coded registration form also. It works successfully, but the login form does not works properly. The registration form code is included in the index page. But the login code is include in login.php page.
Help me to solve this problem.
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h4 style="text-align: center" class="modal-title" id="myModalLabel">
Login & Registration</a></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8" style="border-right: 1px dotted #C2C2C2;padding-right: 30px;">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active">Login</li>
<li>Registration</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="Login">
<form class="form-horizontal" actoin="login.php" method="post" >
<div class="form-group">
<label class="col-sm-2 control-label">
Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="username2" id="username2" placeholder="Username" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="pwd2" id="pwd2" placeholder="Password" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
User Type</label>
<div class="col-sm-10">
<select class="form-control" name="utype" id="utype">
<option selected disabled>User Type</option>
<option value="Admin">Admin</option>
<option value="Student">Student</option>
<option value="Company">Company</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<input type="submit" class="btn btn-primary btn-sm" name="buttonsubmit" id="buttonsubmit" value="Login">
Forgot your password?
</div>
</div>
</form>
</div>
<div class="tab-pane" id="Registration">
<form class="form-horizontal" action="index.php" method="post">
<div class="form-group">
<label class="col-sm-2 control-label">
Title</label>
<div class="col-sm-10">
<div class="row">
<div class="col-md-3">
<select class="form-control" id="uutypex" name="uutype">
<option>Mr.</option>
<option>Ms.</option>
<option>Mrs.</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="name" placeholder="Name" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
User Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="username1" id="username1" placeholder="User Name" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Password</label>
<div class="col-sm-10">
<input class="form-control" name="pwd" id="pwd" type="password" placeholder="Password" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Birth Date
</label>
<div class="col-sm-10">
<input class="form-control" name="bdate" id="bdate" type="date">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="email" placeholder="User Name" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Mobile
</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mobile" id="mobile" placeholder="Mobile" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
University</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="uni" id="uni" placeholder="University" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
User Type
</label>
<div class="col-sm-10">
<select class="form-control" name="type" id="type">
<option selected disabled>User Type</option>
<option value="Admin">Admin</option>
<option value="Student">Student</option>
<option value="Company">Company</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
GPA</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="gpa" id="gpa" placeholder="GPA" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Address</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="address" id="address" placeholder="Address" />
</div>
</div>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<input type="submit" class="btn btn-primary btn-sm" name="buttonregister" id="buttonregister" value="Submit and Save">
<button type="button" class="btn btn-default btn-sm">
Cancel
</button>
</div>
</div>
</form>
</div>
</div>
<div id="OR" class="hidden-xs">
OR</div>
</div>
<div class="col-md-4">
<div class="row text-center sign-with">
<div class="col-md-12">
<h3>
Sign in with
</h3>
</div>
<div class="col-md-12">
<div class="btn-group btn-group-justified">
Facebook <a href="#" class="btn btn-danger">
Google
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
php code
<?php
$conn=mysqli_connect("localhost","root","","internship");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['buttonsubmit'])){
$username=$_POST['username2'];
$password=$_POST['pwd2'];
$type=$_POST['utype'];
$result=mysqli_query($conn,'select * from registration where username="'.$username.'" and password="'.$password.'" and usertype="'.$type.'"');
if(mysqli_num_rows($result)==1 && $type=="Student"){
header('Location: student.php');
}
else
?>
<script> alert("Account invalid!!!! Enter valid Username Password and Usertype")</script>
<?php
}
?>
<?php
$conn=mysqli_connect("localhost","root","","internship");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['buttonsubmit'])){
$username=$_POST['username2'];
$password=$_POST['pwd2'];
$type=$_POST['utype'];
$result=mysqli_query($conn,'select * from registration where username="'.$username.'" and password="'.$password.'" and usertype="'.$type.'"');
if(mysqli_num_rows($result)==1 && $type=="Student"){
session_start();
$_SESSION['user'] = $result;
header('Location: student.php');
}
else
?>
<script> alert("Account invalid!!!! Enter valid Username Password and Usertype")</script>
<?php
}
Can you post the error that you are getting...?
Plus Your code is not secure. You should use php's hash functions to match passwords and use must use PDO to avoid sql injection.
I created a search page with jquery that will display result on same page and I succeed of doing it but the jquery that I made can only show data with index 0 and it will fail if I searched other data with differenct index. I am having Uncaught TypeError: Cannot read property 'StudentNumber' of undefined error in console log.How can I search json object with data matching what is type in the search bar then populate the textbox from db. Please help.... thanks....
$('#btnSearch').click(function(){
var txtValue = $("#txtsearch").val();
$.ajax({
type:"POST",
url:"<?php echo site_url('enrollment/studSearch');?>",
data: {q:txtValue},
dataType: "json",
success: function(data){
//console.log(data.studinfo[0].StudentNumber);
$("#studentnum").val(data.studinfo[0].StudentNumber);
$("#yearLevel").val(data.studinfo[0].YearLevel);
$("#lastname").val(data.studinfo[0].LastName);
$("#firstname").val(data.studinfo[0].FirstName);
$("#middlename").val(data.studinfo[0].MiddleName);
$("#txtTuition").val(data.studinfo[0].TuitionFee);
$("#txtMisc").val(data.studinfo[0].MiscFee);
$("#txtAddFee").val(data.studinfo[0].AdditionalFee);
$("#txtTotal").val(data.studinfo[0].Total);
$("#modeofpayment").val(data.studinfo[0].ModeOfPayment);
$("#payAmount").val(data.studinfo[0].PayableAmount);
},
});
});
my controller:
public function studSearch()
{
$str = $this->input->post('q');
$data['studinfo'] = $this->emodel->search_Student($str);
echo json_encode($data);
}
and the model:
function search_Student($str)
{
$this->db->select('*');
$this->db->from('studentinfo a');
$this->db->join('studFinance b','a.StudentNumber = b.StudentNumber');
$this->db->like('a.StudentNumber',$str);
$this->db->or_like('a.LastName',$str);
$this->db->or_like('a.FirstName',$str);
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
this is the view:
<div id="page-wrapper">
<div id="page-inner">
<div class="row">
<div class="col-lg-12">
<h2>Billing Page</h2>
</div>
</div>
<hr />
<div class="row">
<div class="col-lg-12">
<?php
$attributes = array("class"=>"form- horizontal","id"=>"billform","name"=>"billform",
"autocomplete"=>"off");
echo form_open("enrollment/ebilling",$attributes);
?>
<div class="panel panel-primary">
<div class="panel-heading">
Personal Information
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">Search:</label>
<div class="col-xs-3">
<input type="text" id="txtsearch" name="txtsearch" class="form-control"/>
</div>
<button type="button" class="btn btn-success" id="btnSearch" name="btnSearch">Search</button>
</div>
<div class="form-group col-lg-12">
<hr />
<label class="control-label col-xs-2">Student Number:</label>
<div class="col-xs-3">
<input type="text" readonly id="studentnum" name="studentnum" value="<?php echo set_value('studentnum');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">Year Level:</label>
<div class="col-xs-3">
<input type="text" readonly id="yearLevel" name="yearLevel" value="<?php echo set_value('yearLevel');?>" class="form-control"/>
</div>
<label class="control-label col-xs-2">Last Name:</label>
<div class="col-xs-3">
<input type="text" id="lastname" name="lastname" value="<?php echo set_value('lastname');?>" readonly class="form-control" />
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">First Name:</label>
<div class="col-xs-3">
<input type="text" id="firstname" name="firstname" value="<?php echo set_value('firstname');?>" readonly class="form-control" />
</div>
<label class="control-label col-xs-2">Middle Name:</label>
<div class="col-xs-3">
<input type=-"text" id="middlename" name="middlename" value="<?php echo set_value('middlename');?>" readonly class="form-control" />
</div>
</div>
</div>
</div>
<!-- END OF FIRST PANEL -->
<div class="panel panel-primary">
<div class="panel-heading">
Billing Mode
</div>
<div class="panel-body">
<div class="col-lg-6">
<div class="panel panel-info">
<div class="panel-heading">
Student Account
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Tuition Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtTuition" readonly name="txtTuition" value=" <?php echo set_value('txtTuition');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Miscellaneous Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtMisc" readonly name="txtMisc" value="<?php echo set_value('txtMisc');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Additional Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtAddFee" readonly name="txtAddFee" value="<?php echo set_value('txtAddFee');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Total:</label>
<div class="col-xs-7">
<input type="text" id="txtTotal" readonly name="txtTotal" value="<?php echo set_value('txtTotal');?>" class="form-control"/>
</div>
</div>
</div>
</div>
<!-- END OF FIRST INSIDE PANEL -->
<div class="panel panel-info">
<div class="panel-heading">
Payment
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Mode of Payment:</label>
<div class="col-xs-7">
<input type="text" id="modeofpayment" name="modeofpayment" value="<?php echo set_value('modeofpayment');?>" readonly class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Payable Amount:</label>
<div class="col-xs-7">
<input type="text" id="payAmount" name="payAmount" value="<?php echo set_value('payAmount');?>" readonly class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Date:</label>
<div class="col-xs-7">
<input type="date" id="pDate" name="pDate" value="<?php echo set_value('pDate');?>" class="form-control"/>
<span class="text-danger"><?php echo form_error('pDate');?></span>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">OR Number:</label>
<div class="col-xs-7">
<input type="text" id="orNum" name="orNum" value="<?php echo set_value('orNum');?>" class="form-control"/>
<span class="text-danger"><?php echo form_error('orNum');?></span>
<input type="hidden" id="balance" name="balance"/>
</div>
</div>
<!-- END OF SECOND INSIDE PANEL -->
</div>
</div>
</div>
<div class="col-lg-6">
<table id="billTable" class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>OR Number</th>
<th>Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<td>Balance</td>
</tfoot>
</table>
</div>
<!-- END OF TABLE -->
<div class="col-lg-6">
<div class="form-group col-lg-12">
<input type="button" class="btn btn-success" id="btnAddPayment" name="btnAddPayment"
value="Add Payment"/>
<button type="reset" class="btn btn-danger" id="btnReset" name="reset">Reset</button>
</div>
</div>
</div>
</div>
<?php echo form_close();
echo $this->session->flashdata('msg');?>
</div>
</div>
</div>
</div>
I am working on a PHP based application in which we are getting large amount of data including more than 5 images. The code was working fine for many days but now it just stopped working. When we click the submit button the page reloads but the form does not submit to PHP POST Method. When i remove enctype from form then it gets submitted but the images doesn't pass. And with enctype it is only working with 3 images. if i increase the number of images it stops working.
Code of my application:
<form role="form" name="app_form" id="app_form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<div id="application_form"> <!-- Application Form Starts Here -->
<div class="container-fluid">
<div style="margin-top: 10px; border-top: 3px solid #37A8B3; padding-top: 10px;">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="form-group" style="margin-top: 10px;">
<label class="control-label col-md-2" >Applied For:</label>
<div class="col-md-3">
<input type="text" class="form-control" name="app_for" id="app_for" required>
</div>
<label class="control-label col-md-1">ID No:</label>
<div class="col-md-2">
<input type="text" class="form-control" name="form_id" required>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div style="margin-bottom: 10px;">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload1:</label>
<div class="col-md-2">
<input type="file" name="Upload_1" id="Upload_1" required>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload2:</label>
<div class="col-md-2">
<input type="file" name="Upload_2" id="Upload_2" required>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload3:</label>
<div class="col-md-2">
<input type="file" name="Upload_3" id="Upload_3" required>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload4:</label>
<div class="col-md-2">
<input type="file" name="Upload_4" id="Upload_4" required>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload5:</label>
<div class="col-md-2">
<input type="file" name="Upload_5" id="Upload_5" required>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload6:</label>
<div class="col-md-2">
<input type="file" name="Upload_6" id="Upload_6" required>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Upload7:</label>
<div class="col-md-2">
<input type="file" name="Upload_7" id="Upload_7" required>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="background-color: #37A8B3;">
<h4 style="padding: 5px; color: white;"> PLEASE COMPLETE IN BLOCK CAPITALS </h4>
</div>
<div style="border-bottom: 3px solid #37A8B3;">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="control-label col-md-2 col-lg-2">Title Mr/Mrs/Ms/Other:</label>
<div class="col-md-1">
<select class="form-control" name="user_title" required>
<option value="">Select</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="other">Other</option>
</select>
</div>
<label class="control-label col-md-1" >First Name:</label>
<div class="col-md-2">
<input type="text" class="form-control" name="user_fname" required >
</div>
<label class="control-label col-md-1" >Mid Name:</label>
<div class="col-md-2">
<input type="text" class="form-control" name="user_midname">
</div>
<label class="control-label col-md-1" >Surname:</label>
<div class="col-md-2">
<input type="text" class="form-control" name="user_surname">
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="control-label col-md-3" >Maiden/Former Name<small><i> (List all previous first names and surnames)</i></small>:</label>
<div class="col-md-9">
<input type="text" class="form-control" name="user_formername" required>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="control-label col-md-2" >Current Address:</label>
<div class="col-md-6 input-group-md">
<textarea class="form-control" name="user_curr_addr" rows="2" required></textarea>
</div>
<label class="control-label col-md-1" >Postcode:</label>
<div class="col-md-3 input-group-sm">
<input type="text" class="form-control" name="user_curr_post_code" required>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12" style="margin-top: 20px; margin-bottom: 10px;">
<div class="col-md-2 col-md-offset-5">
<input type="submit" class="form-control btn btn-primary" name="submit_app" value="Submit Application">
</div>
</div>
</div>
</div>
<br>
<br>
<br>
</div>
</div>
</div>
</div>
</div> <!-- Application Form Ends Here -->
</form>
May be at first you tried small images and 5 pieces of small JPEGs didn't exceed your request size, then. Now, you're trying with bigger files and the total of your files are exceeding your request size value, thus you cannot complete your POST requests.
You should have got an error on the way somewherei though, but anyway.
I believe you should increase the request size in you PHP settings. Check the value of request size is bigger than the total size of files you're trying to POST.
I cannot provide you any code, because your question doesn't have any. I am just trying to help you out by pointing where to look.
EDIT:
As I am not a PHP expert, I know that the post size can be changed when you play with the "upload_max_filesize = xxM" and "post_max_size = xxM" which are located in the "PHP.ini" configuration file in your PHP installation directory. These are global values, though. If you're using a hosting panel, chances are you will find PHP specific settings in your panel. Just change or add these settings in order to override the global ones.