html5 input date empty on post php - php

I'm using the HTML5 input date type. After posting, I see this input empty, and all the other inputs (HTML4 types) are OK.
What could be the reason?
This is my form:
<form action="/SGM/index.php?r=manager/addcoach_post" method="post">
<div class="registerFeildArea2">
<div class="registerTxtP2">Family name</div>
<div class="registerFeild">
<input name="lname" type="text" value="" size="" class="registerFeildValue" />
</div>
</div>
<div class="registerFeildArea">
<div class="registerTxtP2">First name</div>
<div class="registerFeild">
<input name="fname" type="text" value="" size="" class="registerFeildValue" />
</div>
</div>
<div class="registerFeildArea2">
<div class="registerTxtP2">Address</div>
<div class="registerFeild">
<input name="address" type="text" value="" size="" class="registerFeildValue" />
</div>
</div>
<div class="registerFeildArea">
<div class="registerTxtP2">City</div>
<div class="registerFeild">
<input name="city" type="text" value="" size="" class="registerFeildValue" />
</div>
</div>
<div class="registerFeildArea2">
<div class="registerTxtP2">Birthdate</div>
<div class="birthDayFeild">
<input name="bdate" id="meeting" type="date" value="2011-01-13"/>
</div>
</div>
<div class="AddBtn"><input name="Next" type="submit" value="הוסף" class="AddBtnValue" /></div>
</form>
And when I get to the actionAddcoach_post(), all the fields are OK except for the bdate.
What could be the reason?

Related

All fields are not displaying in PHP $_POST as well as $_REQUEST

I have a form
<form
method="post"
class="c-form"
action="mail.php"
id="contactform"
>
<div class="row">
<div class="col-lg-12">
<div class="error-alert"></div>
</div>
<div class="col-lg-12">
<input
type="text"
id="subject" name="subject"value="<?php echo $deviceType['device_type_name']; ?> Repair"
/>
</div>
<div class="col-lg-12">
<input
type="text"
placeholder="NAME"
id="name"
name="name"
/>
</div>
<div class="col-lg-12">
<input
type="text"
placeholder="EMAIL"
id="email"
name="email"
/>
</div>
<div class="col-lg-12">
<input
type="text"
placeholder="PHONE NUMBER"
name="phone"
/>
</div>
<div class="col-lg-12">
<textarea
rows="5"
placeholder="YOUR MESSAGE"
id="message"
name="message"
></textarea>
</div>
<div class="col-lg-12">
<input
type="submit"
class="submit"
value="Contact Us"
id="submit"
/>
<img
src="images/ajax-loader.gif"
class="loader"
alt=""
/>
</div>
</div>
</form>
But when I submit the form two fields (subject and message) isn't showing in the $_POST or $_REQUEST array (other 3 fields name, phone and email is present in the array). (the variable $deviceType['device_type_name']; has value, so there is no issue there)
Can anyone please tell me what am I missing here.
mail.php file (nothing much here just for debugging):
<?php
print_r($_POST);
die();?>

How to Fetch Dynamic input field array items value with different name php mysql?

I have a form like below:
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].title" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].isbn" placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0].price" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="button" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
How to get value of this form in php $_Post because the name of fields are like <br/>name="book[0].title"**<br/>?
and there are many dynamic different name input fields.
If you can use for multiple books then use book[0].title like below,
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
If you want to use same form then change name of all textbox like,
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][isbn]." placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0][price]" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="submit" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
And get value of this form like echo $_POST['book'][0]['title'];
I hope this can help you.
You need to change name attribute,
<div class="col-xs-4">
<input type="text" class="form-control" name="book_title" placeholder="Title" />
</div>
book[0].title, this is not valid name.
You can now get something like this,
$_POST['book_title']

How do I use 1 submit button to do 2 actions?

I'm trying to submit data to a list in my mail chimp but also allow the user to upload a file.
Here is my code, the first chunk is the mailchimp autogenerated form which is submitted via:
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
and then it's followed by the basic code to submit a file. But at the moment both functions have a submit button. I want only one. Can anyone help?
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://test.us7.list-manage.com/subscribe/post?u=d12b70d4bb1e08c1568d5b392&id=bfb41cbf75" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</form>
</form>
</body>
You could accomplish this by routing the MailChimp information through your upload_file.php file.
MailChimp has a great API that you can use for more than just adding a subscriber to a list. You would specifically want the listSubscribe() function. There are some great examples on that page.
Here's more documentation on MailChimp's API: http://apidocs.mailchimp.com/api/2.0/
So in your HTML, you would want to remove the second submit button and make it one form with action="upload_file.php". The PHP file would upload the file, then use the API to submit the data to MailChimp.
You html should look like this:
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</body>

undefined index in php using post but it can echo the value using request on update.php

I have these two files and i am updating a table but on the update.php file i get error saying Notice: Undefined index: pname , $pcode...... $pname = $_POST["pname"]; here i am storing pname value in pname variable.but it shows error
<address>
<div class="control-group">
<label class="control-label">Product Name:</label>
<div class="controls">
<input id="pname" name="pname" type="text" value="<?php echo $PName; ?>"
class="input-xlarge">
<p class="help-block"></p>
</div>
</div>
<div class="control-group">
<label class="control-label">Product Code:</label>
<div class="controls">
<input id="code" name="pcode" type="text" value="<?php echo $PCode; ?>"
class="input-xlarge">
</div>
</div>
<div class="control-group">
<label class="control-label">Product Price:</label>
<div class="controls">
<input id="price" name="pprice" type="text" value="<?php echo $PPrice; ?>"
class="input-xlarge">
</div>
</div>
<div class="control-group">
<label class="control-label">Availability:</label>
<div class="controls">
<select id="stock" name="stock" class="input-xlarge">
<option value="1" selected="selected">Available</option>
<option value="0">Not Available</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Product Description:</label>
<div class="controls">
<textarea rows="4" cols="50" name="description" > <?php echo $PDescription; ?> </textarea>
</div>
</div>
<div class="control-group">
Picture 1 :
<div class="controls">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<input type="file" name="pic1"
class="input-xlarge">
</div>
</div>
<div class="control-group">
Picture 2 :
<div class="controls">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<input type="file" name="pic2"
class="input-xlarge">
</div>
</div>
<div class="control-group">
Picture 3 :
<div class="controls">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<input type="file" name="pic3"
class="input-xlarge">
</div>
</div>
<div class="control-group">
<div class="controls">
<input type='hidden' name='id' value="<?php echo $ID; ?>"><br/>
<input type="submit" value="UPDATE" class="btn-large" />
</div>
</div>
</form>
Do you check for form submit?
if (isset($_POST["pname"])) {
// do all your form processing here.
}
$pname= (isset($_POST["pname"]) ? $_POST["pname"] : "");
this will check if pname exists in $_POST and then sets it.
you receive that error because you dont have set $_POST["pname"]

Formmail Redirect Issue

I'm trying to get a Formmail form to re-direct back to it's own page. For example, if I'm on the page, http://www.rightfittech.com/paincenter/contact-us.html, I would like the re-direct to go back to http://www.rightfittech.com/paincenter/contact-us.html, which is the same page.
I searched Google like crazy, and no worthwhile results. The forums keep saying to create a hidden input field
BUT THIS IS NOT WORKING!!!
My code below, and note that I didn't modify formmail, except for email addresses!
<form action="http://www.rightfittech.com/paincenter/formmail.php" name="Contact" method="post"
id="form1">
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER" >
<input type="hidden" name="redirect" value="http://www.rightfittech.com/paincenter/contact-us.html"/>
<input type="hidden" name="recipients" value="robertmyrick#hotmail.com" >
<input type="hidden" name="mail_options" value="FromAddr=robertmyrick#hotmail.com" >
<input type="hidden" name="subject" value="New Contact" >
<div class="wrapper row-2">
<div class="col-1">
<div class="form">
<label>First Name:</label>
<input type="text" />
</div>
<div class="form">
<label>Last Name:</label>
<input type="text" />
</div>
<div class="form">
<label>E-mail:</label><br/>
<input type="text" />
</div>
<div class="form">
<label>Phone Number:</label>
<input type="text" />
</div>
</div>
<div class="col-2">
<div>
<label>Enter Your Message:</label>
<textarea cols="1" rows="1"></textarea>
</div>
<div class="wrapper">
<div class="alignright" style="float:left">
<em><b>Clear</b></em>
<div style="width:20px; float:left"> </div>
<em><b>Submit</b></em></div>
</div>
</form>
Try setting the value good_url instead of redirect.
Like so:
<input type="hidden" name="good_url"
value="http://www.rightfittech.com/paincenter/contact-us.html"/>

Categories