this is my form code, when i am submitting the form i am not getting data in post array,i tried multiple methods but not receiving any response after clicking the button, here is the code
<?php
if (isset($_POST['submit'])) {
echo print_r($_POST);
}
?>
// other stuff
<form class="form-horizontal form-label-left" method="post" action="#" >
<span class="section">Info</span>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name" placeholder="both name(s) e.g Jon Doe" required="required" type="text">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Description <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<textarea id="description" required="required" name="description" class="form-control col-md-7 col-xs-12"></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Type <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select id="type" name="type" required="required" class="selectpicker form-control col-md-7 col-xs-12">
<option title="Combo 1">Weekly</option>
<option title="Combo 2">Monthly</option>
<option title="Combo 3">Annually</option>
</select>
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="submit" value="submit" name="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
change form action. and change button type
Block quote
<form class="form-horizontal form-label-left" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="submit" value="submit" name="submit" class="btn btn-success" value="Submit" />
Try it now :
<?php
if (isset($_POST['submit'])) {
echo print_r($_POST);
}
?>
// other stuff
<form class="form-horizontal form-label-left" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<span class="section">Info</span>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name" placeholder="both name(s) e.g Jon Doe" required="required" type="text">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Description <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<textarea id="description" required="required" name="description" class="form-control col-md-7 col-xs-12"></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Type <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select id="type" name="type" required="required" class="selectpicker form-control col-md-7 col-xs-12">
<option title="Combo 1">Weekly</option>
<option title="Combo 2">Monthly</option>
<option title="Combo 3">Annually</option>
</select>
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="submit" value="submit" name="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
Change these lines in your code
<form class="form-horizontal form-label-left" method="post" action="#" >
<button type="submit" value="submit" name="submit" class="btn btn-success">Submit</button>
With
<form class="form-horizontal form-label-left" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="submit" value="submit" name="submit" class="btn btn-success" value="Submit" />
there was script in my code
<script src="../vendors/jquery/dist/jquery.min.js"></script>
and i name my button "submit" so the error was in console
submit is not a function
so when i change the name of my button to "btnsubmit" it works fine.
When you name the button submit, you override the submit() function on the form.
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 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'>
At the moment I have this bootstrap login form which when you click Sign Up it switches to the sign up form. I've implemented the code for signing up in php along side some validation in PHP using $_POST to check to see if the fields are filled in and passwords match etc however, each time I submit the sign up for it switches back to the login form on the same page however, I want to it to remain on the sign up form if any of the validations fail. How would I go about doing this as simply changing the action="" in the form doesn't work. Here's the code for the bootrstrap login and sign up.
<div class="container">
<div id="loginbox" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info" >
<div class="panel-heading">
<div class="panel-title">Sign In</div>
<div style="float:right; font-size: 80%; position: relative; top:-10px">Forgot password?</div>
</div>
<div style="padding-top:30px" class="panel-body" >
<div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
<form action="login.php" method="post" id="loginform" class="form-horizontal" role="form">
<h5 style="margin-top: 0px"><b>To place an order, please sign in.</b></h5>
<div id="error"></div>
<br>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="username or email">
</div>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="login-password" type="password" class="form-control" name="password" placeholder="password">
</div>
<div class="input-group">
<div class="checkbox">
<label>
<input id="login-remember" type="checkbox" name="remember" value="1"> Remember me
</label>
</div>
</div>
<div style="margin-top:10px" class="form-group">
<!-- Button -->
<div class="col-sm-12 controls">
<p><input id="btn-login" class="btn btn-success" type="submit" name="submit" value="Login" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</div>
</div>
<div class="form-group">
<div class="col-md-12 control">
<div style="border-top: 1px solid#888; padding-top:15px; font-size:85%" >
Don't have an account!
<a href="#" onClick="$('#loginbox').hide(); $('#signupbox').show()">
Sign Up Here
</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="signupbox" style="display:none; margin-top:50px" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Sign Up</div>
<div style="float:right; font-size: 85%; position: relative; top:-10px"><a id="signinlink" href="#" onclick="$('#signupbox').hide(); $('#loginbox').show()">Sign In</a></div>
</div>
<div class="panel-body" >
<form action="" method="post" id="signupform" class="form-horizontal" role="form">
<div id="errorRegistration"></div>
<div id="signupalert" style="display:none" class="alert alert-danger">
<p>Error:</p>
<span></span>
</div>
<div class="form-group">
<label for="username" class="col-md-3 control-label">Username</label>
<div class="col-md-9">
<input type="text" class="form-control" name="newusername" placeholder="Username">
</div>
</div>
<div class="form-group">
<label for="email" class="col-md-3 control-label">Email</label>
<div class="col-md-9">
<input type="text" class="form-control" name="newemail" placeholder="Email Address">
</div>
</div>
<div class="form-group">
<label for="password" class="col-md-3 control-label">Password</label>
<div class="col-md-9">
<input type="password" class="form-control" name="newpassword" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="confirm-password" class="col-md-3 control-label">Confirm Password</label>
<div class="col-md-9">
<input type="password" class="form-control" name="newconfirm-password" placeholder="Confirm Password">
</div>
</div>
<div class="form-group">
<label for="forename" class="col-md-3 control-label">Forename</label>
<div class="col-md-9">
<input type="text" class="form-control" name="forename" placeholder="Forename">
</div>
</div>
<div class="form-group">
<label for="surname" class="col-md-3 control-label">Surname</label>
<div class="col-md-9">
<input type="text" class="form-control" name="surname" placeholder="Surname">
<div class="form-group">
<!-- Button -->
<div class="col-md-offset-3 col-md-9">
<p><input id="btn-signup" class="btn btn-info" type="submit" name="submittedRegister" value="  Sign Up" /></p>
<input type="hidden" name="submittedRegister" value="TRUE" />
</div>
</div>
</form>
</div>
</div>
</div>
</div>
Thanks again for the help! :D
There are many ways to do this, but a simple one would be something like this:
<div id="signupbox" style="<? if (empty($_POST['submittedRegister'])) echo 'display: none;' ?> margin-top:50px" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
(And a modified version for #loginbox)
However, I don't recommend to use style attributes, if you can use classes. It might be easier, but classes help keeping the code clean and maintainable
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 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.