Im trying to get a minimum form value for my Php wordpress form. I want to make that the value is always more than 6. So the visitor have to selected a value above 6 and not below 6. Hope you can help, this is my code so far.
<div class="quantity fl-wrap clearfix">
<span><i class="fa fa-clock-o"></i><?php esc_html_e( 'Maanden: ', 'citybook-add-ons' ); ?></span>
<div class="quantity-item" data-min="1">
<input type="button" value="-" class="minus">
<input type="text" name="lb_quantity" value="6" class="qty" size="4" required="required">
<input type="button" value="+" class="plus">
</div>
</div>
I am not sure what Wordpress plugin your using.
but try changing following line:
<div class="quantity-item" data-min="1">
to:
<div class="quantity-item" data-min="6">
Related
I am very new to php and am still in the learning phase. I typed a small script 1 to 1 and had to find out that the index from my HTML file is not recognized in php. In the given video the "GET" method is used, but it should actually work exactly the same way. It is just a test script. Nevertheless, an answer would be helpful.
Here are my scripts:
HTML:
<form id="register-form" action="Memeon.php" method="post">
<img class="register_avatar" src="pictures/login_register_avatar.png" oncontextmenu="return false;">
<h2>Welcome to Memeon</h2>
<div class="reg-input-div one">
<div class="i">
<i class="fas fa-user"></i>
</div>
<div>
<h5>Username</h5>
<input id="reg_un" class="reg-input" name="username" type="text" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
</div>
<div class="reg-input-div two">
<div class="i">
<i class="fas fa-at"></i>
</div>
<div>
<h5>Email-Adress</h5>
<input id="reg_ea" class="reg-input" name="email" type="email" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
</div>
<div class="reg-input-div three">
<div class="i">
<i class="fas fa-lock"></i>
</div>
<div>
<h5>Password</h5>
<input id="reg_pw" class="reg-input" name="password" type="password" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
</div>
<a id="rl_l1" href="#">2-Factor-Authentication</a>
<a id="rl_l2" href="#">Forgot Password?</a>
<input type="submit" onclick="setRegisterInfo()" class="register_btn" value="Sign in">
</form>
PHP:
<?php
echo "Hallo ". $_POST["username"];
?><br>
Der sehnlichst erwünschte Newsletter wird gesendet an <?php echo $_POST["email"]; ?>
Both are in the same folder. With a submit button I get to the PHP page. An error always appears there.
Maybe it haves to be with something in your "setRegisterInfo()" function (is it implemented ? if so, you should post it here too :) ) in the "onclick" attribute of the submit input at the very end. If that function breaks, the form won't be submitted.
<input type="submit" onclick="setRegisterInfo()" class="register_btn" value="Sign in">
Try again without that function.
<input type="submit" class="register_btn" value="Sign in">
Hi guys please help me out, I have this php code where I get data from the database and displays on the web and if you check the input hidden tag below I gave it a value but instead not all the values are displaying properly in it. Instead it's creating an attribute.
PHP CODE
<?php
$output = '';
$sqlNO = "SELECT * FROM pnewoffer";
$NOresult = mysqli_query($conn, $sqlNO);
if(mysqli_num_rows($NOresult) > 0) {
while($row = mysqli_fetch_array($NOresult)) {
$output .= '<div class="offer-card">
<form action="./bked/savedit.php" method="post">
<a href="#" class="offer-card-inner">
<div class="offer-img">
<img src="./image/'.$row['offerPImage'].'" alt="New Offer Image" width="200">
</div>
<div class="offer-info">
<h3 class="offer-title">'.$row['offerPName'].'</h3>
<div class="clearfix rating marT8 ">
<div class="rating-stars ">
<div class="grey-stars"></div>
<div class="filled-stars" style="width:60.0%"></div>
</div>
</div>
<h4 class="offer-product-price">N'.$row['offerPPrice'].' </h4>
</div>
</a>
<input type="hidden" name="newPPrice" value='.$row['offerPPrice'].'>
<input type="hidden" name="newPName" value='.$row['offerPName'].'>
<input type="hidden" name="newPImg" value='.$row['offerPImage'].'>
<div class="offer-bt-btn">
<div class="offer-btn">
<button type="submit" name="saveForLater" class="favorite-offer-btn">
<i class="far fa-heart"></i>
</button>
<a href="#" class="offer-product-info-btn">
<i class="fa fa-info"></i>
</a>
</div>
</div>
</form>
</div>';
}
}
echo $output;
?>
RESULT
<input type="hidden" name="newPName" value="Blue" louis="" vuitton="" women="" bag="">
<input type="hidden" name="newPName" value="Samsung" galaxy="" s9="" 6gb="" ram,="" 32gb="" rom,="" 16mpbs="">
its actually supposed to be
<input type="hidden" name="newPName" value="Samsung Galaxy S9 6gb ram, 32gb rom, 16mpbs">
<input type="hidden" name="newPName" value="Blue Louis Vuitton Women Bag">
Please, how do I go about it?
If any of the value contain ' characters, that will end the value attribute and start a new attribute. Use htmlspecialchars() to encode it and prevent this.
<input type="hidden" name="newPPrice" value='.htmlspecialchars($row['offerPPrice'], ENT_QUOTES).'>
<input type="hidden" name="newPName" value='.htmlspecialchars($row['offerPName'], ENT_QUOTES).'>
<input type="hidden" name="newPImg" value='.htmlspecialchars($row['offerPImage'], ENT_QUOTES).'>
i have a foreach row that displays the "message icon" (i dont think it has anything to do with the form since the form is outside the loop:
enter image description here
which displays a chat form that you can either type a chat or send an attachment:
enter image description here
How can i make one of them required before submission? I tried through multiple JQuery ways but because they are in a for loop and each of them do not have a special id, its not working. any help please? I just need it to show an alert
Here is my code for the form:
<form method="post"action="<?php echo base_url();?>form_support_chat" enctype="multipart/form-data" class="ticket-reply-form">
<div class="row">
<div class="col-xs-12">
<div class="chat-left">
<input type="text" name="message" placeholder="Type Message ..." class="form-control" autocomplete="off">
<input type="hidden" name="cst_id" value="<?php echo $cst_id; ?>">
<input type="hidden" name="arch_ticket" value="<?php echo $arch_ticket; ?>">
<input type="hidden" name="ticket_number" value="<?php echo $ticket_number?>">
</div>
<div class="chat-right">
<label>
<img src="<?php echo base_url();?>/assest/icon-img/paperclip.png" class="ic_img" >
<input type="file" name="file" class="form-control" style="display:none;" id="hidden_upload_file_chatting">
</label>
<button type="submit" class="btn btn-flat" name="reply" value="reply" >Reply</button>
<button type="button" class="btn btn-flat" data-dismiss="modal" style="margin-left: 10px !important;">Close</button>
<span id="_showName"></span>
</div>
</div>
</div>
</form>
Simply use html5's required value
<input name="cst_id" value="<?php echo $cst_id; ?>" required>
or
<input name="cst_id" value="<?php echo $cst_id; ?>" required="true">
update
Using jQuery, add id value to each input
$(document).ready(function() {
if( $('#input1').valid() || $('#input2').valid(); ):
console.log("Success");
endif;
});
I have a form in HTML with some checkboxes and I want to send an email with the selected checkboxes in the body, the problem is that the "text" fields are passing to the PHP variables, but the checkboxes values are always set to uncheck when I test it on the PHP file:
HTML:
<div class="col-md-6">
<div class="c-checkbox-list">
<div class="c-checkbox">
<input type="checkbox" name="checkbox1citadina" id="checkbox1citadina" value="checkbox1citadina" class="form-control c-check" >
<label for="checkbox1citadina">
<span></span>
<span class="check"></span>
<span class="box"></span> Citadina
</label>
</div>
PHP:
$reservas_bicicletas = '';
if (isset($_POST['checkbox1citadina'])) {
$reservas_bicicletas .= "Citadina: checked\n";
} else {
$reservas_bicicletas .= "Citadina: unchecked\n";
}
echo $reservas_bicicletas;
$reservas_bicicletas always retrieves the else value.
Need help guys, thanks in advance.
remove c-check
<div class="col-md-6">
<div class="c-checkbox-list">
<div class="c-checkbox">
<input type="checkbox" name="checkbox1citadina" id="checkbox1citadina" value="checkbox1citadina" class="form-control " >
<label for="checkbox1citadina">
<span></span>
<span class="check"></span>
<span class="box"></span> Citadina</label>
</div>
Basically i have this (i shorted out the form because there are too many elements):
HTML:
<form name="quick_booking" id="quick_booking" method="post" action="assets/reserva-bicicletas.php">
<div class="col-md-6">
<div class="c-checkbox-list">
<div class="c-checkbox">
<input type="checkbox" name="checkbox1citadina" id="checkbox1citadina" value="checkbox1citadina" class="form-control " >
<label for="checkbox1citadina">
<span></span>
<span class="check"></span>
<span class="box"></span> Citadina</label>
</div>
<button type="submit" class="btn c-theme-btn c-btn-uppercase btn-lg c-btn-bold c-btn-square">Reservar</button>
</form>
I added two extra form elements (radio buttons) within the form of single-product/add-to-cart/variable.php. Now quantity field doesn't work: if I pick "5" for instance, click Add-to-Cart button and visit my Cart, only 1 item was added instead of 5. If I remove my extra elements, it works again. Any suggestion as to what's going on?
I added my form elements right after do_action( 'woocommerce_after_single_variation' ); :
<?php do_action( 'woocommerce_after_single_variation' ); ?>
<div class="auto_replenish_wrap">
<div class="auto_replenish_option">
<input type="radio" name="auto_replenish" value="auto_replenish_no" checked="checked">
<label for="auto_replenish_no">
Deliver one-time only
</label>
</div>
<div class="auto_replenish_option">
<input type="radio" name="auto_replenish" value="auto_replenish_yes">
<label for="auto_replenish_yes">
<div class="auto_replenish_yes_label">
Auto-replenish <a href='#'>(See details)</a>
</div>
<div class="auto_replenish_yes_label_frequency">
<span class="delivery_frequency">
Deliver every
<input type="button" class="minus" value="-">
<input type="text" size="4" class="input-text qty text" title="Qty" value="1" name="quantity" step="1" pattern="[0-9]*" id="delivery_frequency_value" min="1">
<input type="button" class="plus" value="+">
month(s)
</span>
</div>
</label>
</div>
</div>
<div class="add_to_cart_and_learn_more">
<a class="learn_more_after_add_to_cart_button" href="<?php the_permalink(); ?>">Learn More</a>
</div>