how to pass current date in link php
I want to pass a current date in menu link url. I have to face a bug while I pass some from: method="get"
data in url like index.php?hotel_id=1&adult=1
but in my pages I need to show the date in check-in, checkout input box if I doesn't pass any check-in check-out data input field it will be shown tomorrow and day after tomorrow days in input box.
Here is my code:
<form action="index.php" method="GET">
<div class="hotel-level">
<label class="radio-inline">
<input type="radio" name="hotel_id" value="1" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '1') echo 'checked'; else echo 'checked';?> > Ascott The Residence
</label>
<label class="radio-inline">
<input type="radio" name="hotel_id" value="2" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '2') echo 'checked';?>> Ascott Palace
</label>
</div>
<ul>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkin" class="form-control datepicker" name="checkin" placeholder="Check-in" value="<?php echo $arrival_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkin-cal"></span>
</div>
</div>
</li>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkout" class="form-control datepicker" name="checkout" placeholder="Check-out" value="<?php echo $departure_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkout-cal"></span>
</div>
</div>
</li>
<li>
<select name="adult" class="form-control">
<option value>Select Person</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</li>
</ul>
<div class="hotel-submit">
<input type="submit" class="medium brown button" name="submit" value="Submit"/>
</form>
Problems image:
php date datepicker
add a comment |
I want to pass a current date in menu link url. I have to face a bug while I pass some from: method="get"
data in url like index.php?hotel_id=1&adult=1
but in my pages I need to show the date in check-in, checkout input box if I doesn't pass any check-in check-out data input field it will be shown tomorrow and day after tomorrow days in input box.
Here is my code:
<form action="index.php" method="GET">
<div class="hotel-level">
<label class="radio-inline">
<input type="radio" name="hotel_id" value="1" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '1') echo 'checked'; else echo 'checked';?> > Ascott The Residence
</label>
<label class="radio-inline">
<input type="radio" name="hotel_id" value="2" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '2') echo 'checked';?>> Ascott Palace
</label>
</div>
<ul>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkin" class="form-control datepicker" name="checkin" placeholder="Check-in" value="<?php echo $arrival_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkin-cal"></span>
</div>
</div>
</li>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkout" class="form-control datepicker" name="checkout" placeholder="Check-out" value="<?php echo $departure_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkout-cal"></span>
</div>
</div>
</li>
<li>
<select name="adult" class="form-control">
<option value>Select Person</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</li>
</ul>
<div class="hotel-submit">
<input type="submit" class="medium brown button" name="submit" value="Submit"/>
</form>
Problems image:
php date datepicker
1
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
1
If you want to pass date in url with form submit, you can use hidden component.<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
1
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
1
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
I added the bug image in my question
– Sabbir
Jan 20 at 7:05
add a comment |
I want to pass a current date in menu link url. I have to face a bug while I pass some from: method="get"
data in url like index.php?hotel_id=1&adult=1
but in my pages I need to show the date in check-in, checkout input box if I doesn't pass any check-in check-out data input field it will be shown tomorrow and day after tomorrow days in input box.
Here is my code:
<form action="index.php" method="GET">
<div class="hotel-level">
<label class="radio-inline">
<input type="radio" name="hotel_id" value="1" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '1') echo 'checked'; else echo 'checked';?> > Ascott The Residence
</label>
<label class="radio-inline">
<input type="radio" name="hotel_id" value="2" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '2') echo 'checked';?>> Ascott Palace
</label>
</div>
<ul>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkin" class="form-control datepicker" name="checkin" placeholder="Check-in" value="<?php echo $arrival_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkin-cal"></span>
</div>
</div>
</li>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkout" class="form-control datepicker" name="checkout" placeholder="Check-out" value="<?php echo $departure_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkout-cal"></span>
</div>
</div>
</li>
<li>
<select name="adult" class="form-control">
<option value>Select Person</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</li>
</ul>
<div class="hotel-submit">
<input type="submit" class="medium brown button" name="submit" value="Submit"/>
</form>
Problems image:
php date datepicker
I want to pass a current date in menu link url. I have to face a bug while I pass some from: method="get"
data in url like index.php?hotel_id=1&adult=1
but in my pages I need to show the date in check-in, checkout input box if I doesn't pass any check-in check-out data input field it will be shown tomorrow and day after tomorrow days in input box.
Here is my code:
<form action="index.php" method="GET">
<div class="hotel-level">
<label class="radio-inline">
<input type="radio" name="hotel_id" value="1" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '1') echo 'checked'; else echo 'checked';?> > Ascott The Residence
</label>
<label class="radio-inline">
<input type="radio" name="hotel_id" value="2" <?php if (isset($_GET['hotel_id']) && $_GET['hotel_id'] == '2') echo 'checked';?>> Ascott Palace
</label>
</div>
<ul>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkin" class="form-control datepicker" name="checkin" placeholder="Check-in" value="<?php echo $arrival_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkin-cal"></span>
</div>
</div>
</li>
<li>
<div class="input-group date" data-date-format="dd.mm.yyyy">
<input type="text" id="checkout" class="form-control datepicker" name="checkout" placeholder="Check-out" value="<?php echo $departure_date; ?>" autocomplete="off" required/>
<div class="input-group-addon" >
<span class="fa fa-calendar checkout-cal"></span>
</div>
</div>
</li>
<li>
<select name="adult" class="form-control">
<option value>Select Person</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</li>
</ul>
<div class="hotel-submit">
<input type="submit" class="medium brown button" name="submit" value="Submit"/>
</form>
Problems image:
php date datepicker
php date datepicker
edited Jan 20 at 7:11
Shawn Mendez
576
576
asked Jan 20 at 6:34
SabbirSabbir
191114
191114
1
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
1
If you want to pass date in url with form submit, you can use hidden component.<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
1
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
1
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
I added the bug image in my question
– Sabbir
Jan 20 at 7:05
add a comment |
1
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
1
If you want to pass date in url with form submit, you can use hidden component.<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
1
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
1
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
I added the bug image in my question
– Sabbir
Jan 20 at 7:05
1
1
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
1
1
If you want to pass date in url with form submit, you can use hidden component.
<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
If you want to pass date in url with form submit, you can use hidden component.
<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
1
1
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
1
1
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this
/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this
/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
I added the bug image in my question
– Sabbir
Jan 20 at 7:05
I added the bug image in my question
– Sabbir
Jan 20 at 7:05
add a comment |
1 Answer
1
active
oldest
votes
I got my answer thanks all.
just using the if else statement:
$d=strtotime("+1 day");
$d1=strtotime("+2 day");
if($chkindate == ''){
$chkindate = date('Y-m-d',$d);
}
if($checkout == ''){
$checkout = date('Y-m-d',$d1);
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274168%2fhow-to-pass-current-date-in-link-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got my answer thanks all.
just using the if else statement:
$d=strtotime("+1 day");
$d1=strtotime("+2 day");
if($chkindate == ''){
$chkindate = date('Y-m-d',$d);
}
if($checkout == ''){
$checkout = date('Y-m-d',$d1);
}
add a comment |
I got my answer thanks all.
just using the if else statement:
$d=strtotime("+1 day");
$d1=strtotime("+2 day");
if($chkindate == ''){
$chkindate = date('Y-m-d',$d);
}
if($checkout == ''){
$checkout = date('Y-m-d',$d1);
}
add a comment |
I got my answer thanks all.
just using the if else statement:
$d=strtotime("+1 day");
$d1=strtotime("+2 day");
if($chkindate == ''){
$chkindate = date('Y-m-d',$d);
}
if($checkout == ''){
$checkout = date('Y-m-d',$d1);
}
I got my answer thanks all.
just using the if else statement:
$d=strtotime("+1 day");
$d1=strtotime("+2 day");
if($chkindate == ''){
$chkindate = date('Y-m-d',$d);
}
if($checkout == ''){
$checkout = date('Y-m-d',$d1);
}
answered Jan 20 at 7:35
SabbirSabbir
191114
191114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274168%2fhow-to-pass-current-date-in-link-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What the problem you are facing?
– Umar Abdullah
Jan 20 at 6:48
1
If you want to pass date in url with form submit, you can use hidden component.
<input type="hidden" name="date_to_pass" value="<?php echo $date_to_pass; ?>
– robson
Jan 20 at 6:52
1
I have facing a problem when I only get the data of hotel_id=1&adult=1 it returns 1Jan, 1970 date.
– Sabbir
Jan 20 at 6:55
1
passing the the url from another page link I only pass the hotel_id=1&adult=1 in url link like this
/index.php?hotel_id=1&adult=1
– Sabbir
Jan 20 at 6:56
I added the bug image in my question
– Sabbir
Jan 20 at 7:05