I have an HTML page where a form section is included like this :
<?php include 'templates/register-form.php'?>
In a web browser there is no problem and everythig is working .
But on mobile , i can see the section , but cannot tap on it , the input doesn't react and neither the buttons .
What can it be?
thanx!
the code below is the included section.
<form role="form">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="nusername" language="en">username :</label>
<input type="text" class="form-control input-sm login-input" name="nusername" placeholder="שם משתמש" value="<?php echo Input::get('username')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="fullname" language="en">full name :</label>
<input type="text" class="form-control input-sm login-input" name="fullname" placeholder="שם מלא" value="<?php echo Input::get('fullname')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="npassword" language="en">password :</label>
<input type="password" class="form-control input-sm login-input" name="npassword" placeholder="שם מלא" value="<?php echo Input::get('password')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="password_again" language="en">password again :</label>
<input type="password" class="form-control input-sm login-input" name="password_again" placeholder="הקלד את הסיסמא שנית" value="<?php echo Input::get('password_again')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="email" language="en">email:</label>
<input type="email" class="form-control input-sm login-input" name="email" placeholder="אי-מייל" value="<?php echo Input::get('email')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="adress" language="en">adress:</label>
<input type="text" class="form-control input-sm login-input" name="adress" placeholder="כתובת" value="<?php echo Input::get('adress')?>">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="phone" language="en">phone:</label>
<input type="tel" class="form-control input-sm login-input" name="phone" placeholder="טלפון" value="<?php echo Input::get('phone')?>">
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<a class="form-control input-sm register-button btn btn-success pull-left" name="register-button" >הירשם</a>
</div>
</div>
In each field, your label attaches to the input field using the for-attribute. Safari connects for-attributes to id's, not names. Add the correct id to each of your inputs.
Example:
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 pull-right">
<div class="form-group">
<label for="nusername" language="en">username :</label>
<input type="text" class="form-control input-sm login-input" id="username" name="nusername" placeholder="שם משתמש" value="<?php echo Input::get('username')?>">
</div>
</div>
Also, I suspect you just left it out of your example, but don't forget your tag, which might cause some issues in the Browser.
Related
i have a problem regarding with form submission in my code. I have a form that would let the user to input his/her whole information profile and also in my form, i got dynamic input type boxes. In short i have a very large form in my html with JavaScript dynamic input type.
Now my problem is, i am printing the data submitted in my form from view to controller and it doesn't print anything or when i press submit button, the page only refreshes not submitting to the controller.
Here is my full view code:
<form name="Register" class="m-t" role="form" action="<?php echo site_url("user_login/register_user/reg_new") ?>" method="post">
<div class="container">
<div class="picture-container">
<div class="picture">
<img src="https://lh3.googleusercontent.com/LfmMVU71g-HKXTCP_QWlDOemmWg4Dn1rJjxeEsZKMNaQprgunDTtEuzmcwUBgupKQVTuP0vczT9bH32ywaF7h68mF-osUSBAeM6MxyhvJhG6HKZMTYjgEv3WkWCfLB7czfODidNQPdja99HMb4qhCY1uFS8X0OQOVGeuhdHy8ln7eyr-6MnkCcy64wl6S_S6ep9j7aJIIopZ9wxk7Iqm-gFjmBtg6KJVkBD0IA6BnS-XlIVpbqL5LYi62elCrbDgiaD6Oe8uluucbYeL1i9kgr4c1b_NBSNe6zFwj7vrju4Zdbax-GPHmiuirf2h86eKdRl7A5h8PXGrCDNIYMID-J7_KuHKqaM-I7W5yI00QDpG9x5q5xOQMgCy1bbu3St1paqt9KHrvNS_SCx-QJgBTOIWW6T0DHVlvV_9YF5UZpN7aV5a79xvN1Gdrc7spvSs82v6gta8AJHCgzNSWQw5QUR8EN_-cTPF6S-vifLa2KtRdRAV7q-CQvhMrbBCaEYY73bQcPZFd9XE7HIbHXwXYA=s200-no" class="picture-src" id="wizardPicturePreview" title="">
<input type="file" name="employee-picture" id="wizard-picture" class="">
</div>
<h6 class="">Choose Picture</h6>
</div>
</div>
<div class="register-body">
<p>Personal Information</p>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="user_id" id="user_id" class="form-control input-sm" placeholder="User ID" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="first_name" id="first_name" class="form-control input-sm" placeholder="First Name" style="text-transform: capitalize;" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="middle_name" id="middle_name" class="form-control input-sm" placeholder="Middle Name" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="last_name" id="last_name" class="form-control input-sm" placeholder="Last Name" style="text-transform: capitalize;" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="email" name="email" id="email" class="form-control input-sm" placeholder="Email Address" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="contact_no" id="contact_no" class="form-control input-sm" placeholder="Contact Number" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" name="password" id="password" class="form-control input-sm" placeholder="Password" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" name="password_confirmation" id="password_confirmation" class="form-control input-sm" placeholder="Confirm Password" required>
</div>
</div>
</div>
<label for="cvil_stat">Permanent address</label>
<div class="row">
<div class="col-sm-3 col-sm-3 col-md-3">
<label for="cvil_stat">Province</label>
<br>
<select class="form-group" name="province" id="province_id">
<option> ----- Select Option ----- </option>
<?php foreach($provinces as $province)
echo '<option value='.$province->province_id.'>'.$province->province_name.'</option>'?>
</select>
</div>
<div class="col-sm-3 col-sm-3 col-md-3">
<label for="gender">City</label>
<br>
<select class="form-group" name="city" id="city_id">
<option> ----- Select Option ----- </option>
</select>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<br>
<input type="text" name="street_name" id="street_name" class="form-control input-sm" placeholder="House no. / Street name" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="philhealth_no" id="philhealth_no" class="form-control input-sm" placeholder="Philhealth Number" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="pagibig_no" id="pagibig_no" class="form-control input-sm" placeholder="Pag-ibig Number" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="tin_no" id="tin_no" class="form-control input-sm" placeholder="TIN Number" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-sm-6 col-sm-6 col-md-6">
<input type="text" name="dependentnumber" id="dependentnumber" class="form-control input-sm" placeholder="Number of Dependent Child" style="text-transform: capitalize;" required>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="sss_no" id="sss_no" class="form-control input-sm" placeholder="SSS Number" required>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="place_ofb" id="place_ofb" class="form-control input-sm" placeholder="Place of Birth" style="text-transform: capitalize;" required>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-6 col-md-6">
<label for="gender">Birthday</label>
<br>
<select class="form-group" name="bday_month">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
<select class="form-group" name="bday_day">
<?php for($i=1;$i<32;$i++) { ?>
<option><?php echo $i ?></option>
<?php } ?>
</select>
<select class="form-group" name="bday_year">
<?php $y = date('Y'); ?>
<?php for($j=0;$j<120;$j++) { ?>
<option><?php echo $y-$j ?></option>
<?php } ?>
</select>
</div>
<div class="col-sm-6 col-sm-6 col-md-6">
<label for="gender">Religion</label>
<br>
<select class="form-group" name="religion">
<option> ----- Select Option ----- </option>
<?php foreach($religions as $religion)
echo '<option value='.$religion->religion_id.'>'.$religion->religion_name.'</option>'?>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-6 col-md-6">
<label for="cvil_stat">Civil Status</label>
<br>
<select class="form-group" name="civil_stat" id="civil_stat">
<option> ----- Select Option ----- </option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Legally Separated">Legally Separated</option>
<option value="Widowed">Widowed</option>
</select>
</div>
<div class="col-sm-6 col-sm-6 col-md-6">
<label for="gender">Citizenship</label>
<br>
<select class="form-group" name="citizenship">
<option> ----- Select Option ----- </option>
<?php foreach($citizenships as $citizenship)
echo '<option value='.$citizenship->citizenship_id.'>'.$citizenship->citizenship_name.'</option>'?>
</select>
</div>
</div>
<p>Family Background</p>
<div class="row" id="field_div">
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="fathers_name" id="fathers_name" class="form-control input-sm" placeholder="Father's Name" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<div class="form-group">
<input type="text" name="fathers_occu" id="fathers_occu" class="form-control input-sm" placeholder="Occupation" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<div class="form-group">
<input type="text" name="fdate_birth" id="fdate_birth" class="form-control input-sm" placeholder="Date of birth" style="text-transform: capitalize;" required>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="mothers_name" id="mothers_name" class="form-control input-sm" placeholder="Mother's Name" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<div class="form-group">
<input type="text" name="mothers_occu" id="mothers_occu" class="form-control input-sm" placeholder="Occupation" style="text-transform: capitalize;" required>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<div class="form-group">
<input type="text" name="mdate_birth" id="mdate_birth" class="form-control input-sm" placeholder="Date of birth" style="text-transform: capitalize;" required>
</div>
</div>
</div>
<p>Educational Background</p>
<div class="control-btns">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3">
<button class="btn btn-primary btn-sm" onclick="add_field_educ(event);">+</button>
<button class="btn btn-danger btn-sm" onclick="remove_field_educ(event);">-</button>
</div>
</div>
</div>
<div id="wrapper_educ">
<div id="educ_div">
</div>
</div>
<p>Work Experience</p>
<div class="control-btns">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3">
<button class="btn btn-primary btn-sm" onclick="add_field_work(event);">+</button>
<button class="btn btn-danger btn-sm" onclick="remove_field_work(event);">-</button>
</div>
</div>
</div>
<div id="wrapper_work">
<div id="work_div">
</div>
</div>
<div class="register_footer">
<button type="submit" value="Register" class="btn btn-primary">Register</button>
<button class="btn btn-primary">Clear</button>
</div>
</div>
</div>
</form>
Here is my controller code that i want to print my submitted code:
public function reg_new() {
$this->form_validation->set_message('is_unique', 'The %s is already taken.');
$this->form_validation->set_error_delimiters('<div class="error"><li>','</li></div>');
if ($this->form_validation->run('reg_config') == FALSE) {
$this->index();
} else {
$register_data = array(
'User_Id' => $this->input->post('user_id'),
'First_Name' => $this->input->post('first_name'),
'Middle_Name' => $this->input->post('middle_name'),
'Last_Name' => $this->input->post('last_name'),
'Email' => $this->input->post('email'),
'Contact_no' => $this->input->post('contact_no'),
'Password' => $this->bcrypt->hash_password($this->input->post('password')),
'City_id' => $this->input->post('city'),
'Street' => $this->input->post('street_name'),
'Philhealth_num' => $this->input->post('philhealth_no'),
'Pagibig_num' => $this->input->post('pagibig_no'),
'Tin_num' => $this->input->post('tin_no'),
'Dependent_children' => $this->input->post('dependentnumber'),
'Sss_num' => $this->input->post('sss_no'),
'Place_of_birth' => $this->input->post('place_ofb'),
'Gender' => $this->input->post('gender'),
'Birthdate' => $this->input->post('bday_year') . "-" . date("m",strtotime($this->input->post('bday_month'))) . "-" . $this->input->post('bday_day'),
'Religion' => $this->input->post('religion'),
'Citizenship' => $this->input->post('citizenship'),
'Civil_status' => $this->input->post('civil_stat'),
'fathers_name' => $this->input->post('fathers_name'),
'fathers_occupation' => $this->input->post('fathers_occu'),
'father_bdate' => $this->input->post('fdate_birth'),
'mothers_name' => $this->input->post('mothers_name'),
'mothers_occupation' => $this->input->post('mothers_occu'),
'mother_bdate' => $this->input->post('mdate_birth'),
'User_Status' => $this->user_stat,
'Delete_Status' => 0,
'Position_Id' => 0,
);
if($this->input->post('civil_stat') == 'Married') {
$spouse_data = array (
'Spouse_name' => $this->input->post('spouse_name'),
'Spouse_occupation' => $this->input->post('spouse_occu'),
'Spouse_bdate' => $this->input->post('spouse_dateofb'),
);
}
foreach ($this->input->post('educ_opt') as $educ) {
$count_educ = $count_educ++;
}
print_r($register_data);
print_r($count_educ);
print_r($spouse_data);
}
}
please take a look with my code why i cant submit it from controller.
thanks.
Thanks guys.. i just figured it out, its because of my form validation that i thought it doesn't submit because it did not satisfy my form validation and for that i returned $this->index();
I tried to insert multiple rows in sql . But it inserts only the last one row and in that one row only storing first character of each column. I prints the query by echo, it shows only one last row, but gives all characters of each column. one more thing is iam inserting values in two tables by clicking on submit button. can anyone help on this.
Here it is the view :
<form class="" method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>dashboard/addnewjobmela" >
<input type="hidden" name="csrfmiddlewaretoken" value="LgVIVf7yFe5bL9k2Rcj9TGLLpgKJX1LkmfiiptEZnN95y9WqKXHk7V4vGixmo6Wd">
<input type="hidden" id="cperson_no" value="1">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Mela Title</label>
<input class="form-control" type="text" name="title" required="" id="title">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Job Mela Date</label>
<input class="form-control" type="date" name="date" required="" id="date">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Last Date To Register</label>
<input class="form-control" type="date" name="laastdatetoregister" required="" id="laastdatetoregister">
</div>
</div>
<div class="col-xs-12 col-sm-12 ">
<div class="form-group">
<label>Venue Details</label>
<textarea class="form-control" name="venuedetails" cols="40" rows="2" required="" id="venuedetails"></textarea>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Person</label>
<input class="form-control" type="text" name="contactperson" required="" id="contactperson">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Emailid</label>
<input class="form-control" type="text" name="emailid" required="" id="emailid">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Number</label>
<input class="form-control" type="text" name="contactnumber" required="" id="contactnumber">
</div>
</div>
</div>
<div class="row-fluid" >
<div style="background-color:#d6e9c6 !important;padding:10px"><p class="text-success"><b>Participating Companies</b></p></div>
</div>
<div class="col-xs-12 right" style="margin-top:-40px;margin-bottom: 20px">
<button class="btn btn-success" type="button" onclick="addingcompanies()">Add More</button>
</div>
<div id="companies">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Company Name</label>
<input class="form-control" type="text" name="company" required="" id="company">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Title</label>
<input class="form-control" type="text" name="jobtitle" required="" id="jobtitle">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Required Qualification</label>
<?php
echo form_dropdown('qualification', $education,'' ,'required="" class="form-control"');
?>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Specialization</label>
<input class="form-control" type="text" name="specialization" required="" id="specialization">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Sector</label>
<input class="form-control" type="text" name="sector" required="" id="sector">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Job Type</label>
<?php
echo form_dropdown('jobtype', $jobtype,'' ,'required="" class="form-control"');
?>
</div>
</div>
<!-- <div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Company Logo</label>
<input class="form-control" type="file" name="picture" accept=".jpeg,.JPEG,.JPG,.jpg,.png,.PNG" required="" id="id_picture">
</div>
</div> -->
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Location</label>
<input class="form-control" type="text" name="joblocation" required="" id="joblocation">
</div>
</div>
</div>
</div>
<div class="col-xs-12" style="text-align:center">
<button class="btn btn-success" type="submit" value="Save Profile">Submit</button>
</div>
</form>
Javascript/Jquery to add ADD More Fields
<script type="text/javascript">
function addingcompanies()
{
var cperson_no = $('#cperson_no').val();
var j=parseInt(cperson_no)+1;
$('#cperson_no').val(j);
var qualification = '<?php echo str_replace("'", '', preg_replace("/\r|\n/", "", form_dropdown('qualification', $education,'' ,'required="" class="form-control"'))); ?>';
var jobtype = '<?php echo str_replace("'", '', preg_replace("/\r|\n/", "", form_dropdown('jobtype', $jobtype,'' ,'required="" class="form-control"'))); ?>';
$('#companies').append('<div class="row group"><hr/><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Company Name</label> <input class="form-control" type="text" name="company" required="" id="company' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Job Title</label> <input class="form-control" type="text" name="jobtitle" required="" id="jobtitle' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Required Qualification</label> '+ qualification +'</div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Specialization</label> <input class="form-control" type="text" name="specialization" required="" id="specialization' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Sector</label> <input class="form-control" type="text" name="sector" required="" id="sector' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4"> <div class="form-group"> <label>Job Type</label>'+jobtype+' </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Job Location</label> <input class="form-control" type="text" name="joblocation" required="" id="joblocation' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-4 col-md-4 "><button class="btn btn-danger" style="margin-top: 25px; !important;" type="button" onClick="con_grpremove(this)">Remove</button></div></div></div>');
}
function con_grpremove(obj) {
$(obj).closest(".group").remove();
}
</script>
Here it is the controller :
public function addnewjob()
{
$this->load->model('dashboard_model');
$result = $this->dashboard_model->addnewjob();
$this->session->msg = "New Job Added Successfully";
redirect('dashboard');
}
public function addnewjobmela()
{
$this->load->model('dashboard_model');
$result = $this->dashboard_model->addnewjobmela();
$this->session->msg = "New Job Mela Added Successfully";
redirect('dashboard');
}
Model :
public function addnewjobmela() {
$data['title'] = $this->input->post('title');
$data['date'] = $this->input->post('date');
$data['lastdate'] = $this->input->post('laastdatetoregister');
$data['venue'] = $this->input->post('venuedetails');
$data['contactperson'] = $this->input->post('contactperson');
$data['emailid'] = $this->input->post('emailid');
$data['contactnumber'] = $this->input->post('contactnumber');
$data['status'] = 1;
$data['id'] = $this->db->insert_id();
print_r($data);
$this->db->insert('jobmelas', $data);
$jobmelaid = $this->db->insert_id();
$jcdata['company'] = $this->input->post('company');
$jcdata['jobtitle'] = $this->input->post('jobtitle');
$jcdata['qualification'] = $this->input->post('qualification');
$jcdata['specialization'] = $this->input->post('specialization');
$jcdata['sector'] = $this->input->post('sector');
$jcdata['jobtype'] = $this->input->post('jobtype');
$this->insCompanies($jobmelaid, $jcdata);
}
public function insCompanies($jobmelaid, $jcdata, $update='') {
if($update == 'update'){
$this->db->query('delete from job_mela_companies where jobmelaid = '.$jobmelaid.'');
}
print_r($jcdata);
for ($i = 0; $i < count($jcdata['company']); $i++) {
$cp_data[] = array(
'jobmelaid' => $jobmelaid,
'company' => $jcdata['company'][$i],
'jobtitle' => $jcdata['jobtitle'][$i],
'qualification' => $jcdata['qualification'][$i],
'specialization' => $jcdata['specialization'][$i],
'jobtype' => $jcdata['jobtype'][$i],
'sector' => $jcdata['sector'][$i]
);
$this->db->insert('job_mela_companies', $cp_data);
}
}
First table is giving result correct but
The output of more fields giving like this:
try below array and remove $cp_data[] = array(....) from insCompanies function.
$cp_data = array(
'jobmelaid' => $jobmelaid,
'company' => $jcdata['company'][$i],
'jobtitle' => $jcdata['jobtitle'][$i],
'qualification' => $jcdata['qualification'][$i],
'specialization' => $jcdata['specialization'][$i],
'jobtype' => $jcdata['jobtype'][$i],
'sector' => $jcdata['sector'][$i]
);
<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Member No of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12">
<input required="" class="form-control col-md-7 col-xs-12" id="old_member_no" type="number" name="old_member_no" <?php if(isset($editData)) echo 'readonly style="pointer-events: none;"'; ?> value="{{ old('old_member_no',isset($editData) ? $editData->old_member_no:"") }}">
<input type="hidden" name="member_no" value="{{ old('member_no',isset($editData) ? $editData->member_no:"") }}" />
</div>
<span class="help-block"></span>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Name of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12 ">
<input required="" class="form-control col-md-7 col-xs-12" id="" type="text" name="full_name" value="{{ old('full_name',isset($editData) ? $editData->full_name:"") }}">
</div>
<span class="help-block"></span>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-3 col-xs-12" for="">Address of the Transferer<span class="required">*</span></label>
<div class="col-md-3 col-sm-6 col-xs-12 ">
<input required="" class="form-control col-md-7 col-xs-12" id="house" type="text" name="house" value="{{ old('house',isset($editData) ? $editData->house:"") }}">
</div>
<span class="help-block"></span>
</div>
Hello guys. I'm doing a project. I'm developing a form with autopopulate. If number is typed and after pressing enter the address and name should be fetched from database. kindly help me
Since it is not clear to me but base on your descriptions... You would need to use Javascript/JQuery here and use Event functions when the entering a field
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
I want to add a contact form on my page but I've never worked with PHP before. I need help, please?
I'm working with the form below:
<a name="Contact"></a>
<div class="contact">
<div class="container">
<div class="row">
<div class="col-lg-8">
<h1 class="page-header text-center">Get in touch!</h1>
<form class="form-horizontal" role="form" method="post" action="index.php">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name="name" placeholder="First & Last Name" value="<?php echo htmlspecialchars($_POST['name']); ?>">
<?php echo "<p class='text-danger'>$errName</p>";?>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" name="email" placeholder="example#domain.com" value="<?php echo htmlspecialchars($_POST['email']); ?>">
<?php echo "<p class='text-danger'>$errEmail</p>";?>
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="4" name="message"><?php echo htmlspecialchars($_POST['message']);?></textarea>
<?php echo "<p class='text-danger'>$errMessage</p>";?>
</div>
</div>
<div class="form-group">
<label for="human" class="col-sm-2 control-label">2 + 3 = ?</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="human" name="human" placeholder="Your Answer">
<?php echo "<p class='text-danger'>$errHuman</p>";?>
</div>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-sm-offset-2">
<?php echo $result; ?>
</div>
</div>
</form>
</div>
For for some reason, it's not displaying properly. This is how it looks:
screenshot of contact form