I have the following code for a form in my site for reservations, but the email I'm getting has all the information of the form cramped up, and need to separate each field in a new line. Must be pretty easy for anyone, I'm just not good at code.
<form <?php echo !empty($post_options['id']) ? ' id="'.esc_attr($post_options['id']).'"' : ''; ?> data-formtype="<?php echo esc_attr($post_options['layout']); ?>" method="post" action="<?php echo esc_url($post_options['action'] ? $post_options['action'] : admin_url('admin-ajax.php')); ?>">
<?php jarvis_sc_form_show_fields($post_options['fields']); ?>
<div class="sc_form_info">
<div class="sc_form_item sc_form_field none"><input type="text" name="eventname" value="<?php echo (!empty($eventname)) ? esc_attr($eventname) : esc_html__('Any', 'jarvis'); ?>"></div>
<div class="sc_form_item sc_form_field label_over"><input type="text" name="username" placeholder="<?php esc_attr_e('Name', 'jarvis'); ?>"></div>
<div class="sc_form_item sc_form_field label_over"><input type="text" name="email" placeholder="<?php esc_attr_e('E-mail', 'jarvis'); ?>"></div>
<div class="sc_form_item sc_form_field label_over"><input type="number" name="number" min="1" max="1000" placeholder="<?php esc_attr_e('Number of people', 'jarvis'); ?>"></div>
</div>
<div class="sc_form_item sc_form_field date_time">
<div class="sc_form_item sc_form_item_date sc_form_field label_top">
<div class="sc_form_date_wrap icon-calendar-light">
<input placeholder="Date" class="js__datepicker" type="text" >
</div>
</div>
<div class="sc_form_item sc_form_item_time sc_form_field label_top">
<div class="sc_form_time_wrap icon-clock-empty">
<input placeholder="Time" class="js__timepicker" type="text" >
</div>
</div>
</div>
<div class="sc_form_item sc_form_button"><button class="sc_button sc_button_style_border gradient_bd hover"><?php esc_html_e('Book the table', 'jarvis'); ?></button></div>
<div class="result sc_infobox"></div>
</form>
Help is appreciated. ;)
add a <br> to add line breaks and start at a new line.
The HTML element produces a line break in text (carriage-return). It
is useful for writing a poem or an address, where the division of
lines is significant.
See the example below
<p>
Hi <br>
i <br>
am using multiple <br>
breaks <br>
</p>
Hope this helps!
Related
I am getting this error,
A PHP Error was encountered
Severity: Notice
Message: Trying to get property 'post_title' of non-object.
I cannot get the form inputs to print on the page and cannot update. Please help!
So, I have tried to update each record and only artist users are able to do that. But I cannot figure out how to show the individual post on the form page. The records saves correctly and deletes but cannot update them.
Controller
function editpost($post_id)//Edit post page
{
if (!$this->session->Role =='member,artist')
{
redirect(base_url() . 'login');
}
$data['success'] = 0;
if( !empty($this->input->post('post_title')) ) {
$data['post_title'] = $this->input->post('post_title');
$data['post'] = $this->input->post('post');
$data['active'] = 1;
/* >> file attach */
View
<form action="<?= base_url()?>starter/editpost/" method="post" class="justify-
content-center" enctype='multipart/form-data'>
<div class="form-group">
<label class="sr-only">Title</label>
<input type="text" class="form-control" placeholder="Title"
name="post_title" value="<?php echo $post->post_title; ?>">
</div>
<div class="form-group">
<label class="sr-only">Description</label>
<textarea class="form-control" placeholder="Describe it" name="post" ><?
php echo $post->post; ?></textarea>
</div>
<div class="row py-4">
<div class="col-lg-6 mx-auto">
<!-- Upload image input-->
<!-- File Button -->
<div class="col-md-5">
<input name="main_img[]" type="file" accept="image/x-png,image/gif,image/jpeg">
</div>
<br>
<br>
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="update"
value="Publish" /></p>
</form>
use direct the variable because you are passing just values which you are posting from form.
//like :
//for post_title
<input type="text" class="form-control" placeholder="Title"
name="post_title" value="<?php echo $post_title; ?>">
// for description
textarea class="form-control" placeholder="Describe it" name="post" ><?
php echo $post; ?></textarea>
You don't need to pass the post data in controller you can get post data anywhere
<input type="text" class="form-control" placeholder="Title" name="post_title" value="<?php echo ($this->input->post('post_title')!='')?$this->input->post('post_title'):''; ?>">
I am trying to make a radio button with 2 options i.e. option A and Option B.
I have 2 text input ( A and B ) and some other text input that always has to be there.
Option A of the radio button has to make disappear text input (A) and show another text input (B). Option B should make this the opposite. ( disappear text input (B) and show another text input (A) )
I don't know how to make that 2 text inputs.
will appreciate some help.
<form class="user" id="RegisterForm" action="" method="post">
<? print("USER ROLE : ") ?>
<input type="radio" name="user_role" <?php if (isset($user_role) && $user_role=="A") echo "checked";?> value="A">A
<input type="radio" name="user_role" <?php if (isset($user_role) && $user_role=="B") echo "checked";?> value="B">B
//REST OF the code defines some text inputs that are always should show.
<?php if ($fullname_req != "-1") { ?>
<div class="form-group">
<input type="text" class="form-control form-control-user" id="displayname" name="fullname" placeholder="<?php _e('Display name', 'user-panel-pro') ?>">
</div>
<?php } ?>
<?php if ($firstname_req != "-1") { ?>
<div class="form-group row">
<?php if ($firstname_req != "-1" or $lastname_req != "-1") { ?>
<div class="col-sm-6 mb-3 mb-sm-0">
<input type="text" class="form-control form-control-user" id="First-Name" name="firstname" placeholder="<?php _e('first name', 'user-panel-pro') ?>">
</div>
<?php } ?>
<?php if ($lastname_req != "-1") { ?>
<div class="col-sm-6">
<input type="text" class="form-control form-control-user" id="Last-Name" name="lastname" placeholder="<?php _e('last name', 'user-panel-pro') ?>">
</div>
<?php } ?>
</div>
<?php } ?>
<?php if ($username_req != "-1") { ?>
<div class="form-group">
<input type="text" class="form-control form-control-user" id="User-Name" name="username" placeholder="<?php _e('Username', 'user-panel-pro') ?>">
</div>
<?php } ?>
<?php if ($email_req != "-1") { ?>
<div class="form-group">
<input type="email" class="form-control form-control-user" id="Email" name="email" placeholder="<?php _e('Email', 'user-panel-pro') ?>">
</div>
<?php } ?>
I am not able to understand your code, so I am just giving a small demo
<div class="radioBtns">
<label for='rbtnLoginTypeMobile'><input checked type="radio" id="rbtnLoginTypeMobile" name="rbtnLoginType" value='1' onclick="showLogin(1)"/><span>Mobile</span></label>
<label for='rbtnLoginTypeEmail'><input type="radio" id="rbtnLoginTypeEmail" name="rbtnLoginType" value='0' onclick="showLogin(0)" /><span>Email</span></label>
</div>
<div class="mobilelogin">Your Mobile Div</div>
<div class="emaillogin">Your Email Div</div>
<script type="text/javascript">
function showLogin(val)
{
if(val==1)
{
$('.emaillogin').css('display','none');
$('.mobilelogin').css('display','');
}
else
{
$('.mobilelogin').css('display','none');
$('.emaillogin').css('display','');
}
}
</script>
I created an HTML form that passes variables to an exec_shell. Everything worked perfectly until I added CSS to my HTML page. The new HTML+CSS code doesn't pass the variables to the php shell_exec.
Before (working):
<body>
<form action="adduser.php" method="post">
Server: <input type="text" value="<?php echo $name; ?>" name="name"><br>
Password: <input type="text" value="<?php echo $password; ?>" name="password"><br>
<input type="submit">
</form>
</body>
After (not working):
<form action="adduser.php" method="post" class="contact3-form validate-form">
<span class="contact3-form-title">
Title
</span>
<div class="wrap-input3 validate-input" data-validate="Server Name is required">
<input class="input3" type="text" value="<?php echo $hosts; ?>" name="hosts" placeholder="Server Name or Server Group">
<span class="focus-input3"></span>
</div>
<div class="wrap-input3 validate-input" data-validate = "Valid Password is required">
<input class="input3" type="text" value="<?php echo $password; ?>" name="password" placeholder="Your Password">
<span class="focus-input3"></span>
</div>
<div class="container-contact3-form-btn">
<button class="contact3-form-btn">
Submit
</button>
</div>
</form>
I also tried:
value="<' . $hosts .'"
Is there a better way to do it than HTML ?
Thank you.
your button don't have type="submit"
I have a form which is posted via php and if I get a error it highlights only the input field red. What I would like to do or know if there is a way to do is highlight the whole div field which contains the select field and everything and show that this whole div has a error.
Here is my html code.
<div class="form-group">
<div class="<?php if(form_error('fullname')!= null){echo ' has-error';} ?>">
<label class="col-md-4 control-label">
<?php echo lang("full_name"); ?>
</label>
<div class="col-md-8">
<input type="text" name="fullname" class="form-control" value="<?php if (isset($userinfo['Fullname'])) {echo $userinfo['Fullname'];} ?>" placeholder="<?php echo lang(" fullname "); ?>">
</div>
</div>
</div>
Right now it only highlights input field but I want it to highlight the whole div form-group.
Since you are using bootstrap, you could try this. Please change
<div class="form-group">
to
<div class="form-group alert alert-danger">
Try this.
<div class="form-group <?php if(form_error('fullname')!= null){echo ' bg-danger';} ?>">
<div class="<?php if(form_error('fullname')!= null){echo ' has-error';} ?>">
<label class="col-md-4 control-label">
<?php echo lang("full_name"); ?>
</label>
<div class="col-md-8">
<input type="text" name="fullname" class="form-control" value="<?php if (isset($userinfo['Fullname'])) {echo $userinfo['Fullname'];} ?>" placeholder="<?php echo lang(" fullname "); ?>">
</div>
</div>
</div>
What I have done is used, .bg-danger, one of the Bootstrap Contextual Classes based on the same if condition you have to apply the has-error class.
Ok - I've recently purchased a template and have an OK understanding of PHP.
The problem i'm getting is the PHP Variables are not being detected (or are blank) even though i've clearly declared them, I have lost my wits with this issue.
In transferConfirm.php
$name = $_POST['name'];
$cid = $_POST['cid'];
$clink = $_POST['clink'];
$mviews = $_POST['mviews'];
$subs = $_POST['subs'];
$cnetwork = $_POST['cnetwork'];
$nnetwork = $_POST['nnetwork'];
In transfer.php
<section id="contact-form">
<div class="container">
<div class="col-lg-12 section-title-price wow flipInX">
<h2><small>Partner Transfer</small></h2>
<p class="lead"><span class="highlight">Learn More About Network Transfers</span></p>
</div>
<div class="col-lg-12 text-center wow flipInX" id="contact">
<div id="message"></div>
<form method="post" action="transferConfirm.php" name="contactform" id="contactform">
<fieldset>
<div class="col-md-6">
<p><strong>Channel Information</strong></p>
<input name="name" type="text" id="name" size="30" placeholder="Full Name"/>
<br />
<input name="cid" type="text" id="cid" placeholder="Customer ID"/>
<br />
<input name="clink" type="text" id="email" placeholder="Channel Link"/>
<br />
<input name="mviews" type="text" id="mviews" placeholder="Monthly Views"/>
<br />
<input name="subs" type="text" id="subs" placeholder="Subscribers"/>
</div>
<div class="col-md-6">
<p><strong>Network Information</strong></p>
<input name="cnetwork" type="text" id="cnetwork" placeholder="Current Network Name"/>
<br />
<input name="nnetwork" type="text" id="nnetwork" placeholder="New Network Name"/>
</div>
<div class="col-md-12 text-center">
<input type="submit" class="submit" id="submit" value="Submit Transfer" />
</div>
</fieldset>
</form>
</div>
</div>
</section>
I know some of the code may look dodgey in the HTML - But i can't see it being the reason of the error. However, the $name variable seems to be the only one working?!
Here's where the error occurs:
echo "<fieldset>";
echo "<div id='success_page'>";
echo "<h4 class='highlight'>Thank you <strong>$name</strong>, your messaged has been submitted to us.</h4>";
echo "<h4 class='highlight'>Thank you <strong>$cid</strong>, your message has been submitted to us.</h4>";
echo "</div>";
echo "</fieldset>";
The $name seems to be working but the $cid isn't?!
The form is submitting to transferConfirm.php, not confirmTransfer.php. Try changing either the filename or the form submit action.