par
Lay » 24 août 2016, 12:11
Merci beaucoup pour ton aide !!!
le mailer est ok et les dates j ai trouve pourquoi je n arrivais pas a definir correctement les weekend, c est a cause de la syntaxe !
Le seul petit truc maintenant c est que je voudrais que le VENDREDI soit consideré comme un weekend.
la reponse ce situe la : if (date('w', strtotime($selected_date)) == 6 or date('w', strtotime($selected_date)) == 0) { mais je vois pas trop comment faire
tu aurais une idee ?
Merci beaucoup !
[code <select name="date_selection" id="date_selection" onchange="this.form.submit()">
<option value="<?php echo date('Y-m-d'); ?>" <?php if ( strtotime(date('Y-m-d')) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M'); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+1 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+1 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+1 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+2 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+2 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+2 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+3 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+3 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+3 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+4 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+4 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+4 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+5 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+5 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+5 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+6 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+6 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+6 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+7 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+7 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+7 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+8 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+8 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+8 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+9 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+9 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+9 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+10 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+10 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+10 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+11day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+11 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+11 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+12 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+12 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+12 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+13 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+13 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+13 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+14 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+14 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+14 day')); ?></option>
</select>
</form>
<p></p>
<?php
if (date('w', strtotime($selected_date)) == 6 or date('w', strtotime($selected_date)) == 0) {
/* C'est un samedi ou un dimanche */
?>[/code]
Merci beaucoup pour ton aide !!!
le mailer est ok et les dates j ai trouve pourquoi je n arrivais pas a definir correctement les weekend, c est a cause de la syntaxe !
Le seul petit truc maintenant c est que je voudrais que le VENDREDI soit consideré comme un weekend.
la reponse ce situe la : [b]if (date('w', strtotime($selected_date)) == 6 or date('w', strtotime($selected_date)) == 0) {[/b] mais je vois pas trop comment faire
tu aurais une idee ?
Merci beaucoup !
[code <select name="date_selection" id="date_selection" onchange="this.form.submit()">
<option value="<?php echo date('Y-m-d'); ?>" <?php if ( strtotime(date('Y-m-d')) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M'); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+1 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+1 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+1 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+2 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+2 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+2 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+3 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+3 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+3 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+4 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+4 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+4 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+5 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+5 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+5 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+6 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+6 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+6 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+7 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+7 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+7 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+8 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+8 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+8 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+9 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+9 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+9 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+10 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+10 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+10 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+11day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+11 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+11 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+12 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+12 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+12 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+13 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+13 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+13 day')); ?></option>
<option value="<?php echo date('Y-m-d', strtotime('+14 day')); ?>" <?php if ( strtotime(date('Y-m-d', strtotime('+14 day'))) == strtotime($selected_date) ) { echo "selected=\"selected\""; } ?> ><?php echo date('D d M', strtotime('+14 day')); ?></option>
</select>
</form>
<p></p>
<?php
[b]if (date('w', strtotime($selected_date)) == 6 or date('w', strtotime($selected_date)) == 0) {[/b]
/* C'est un samedi ou un dimanche */
?>[/code]