Jump to content

Event calender- PHP


fdgdfgdfg
 Share

Recommended Posts

Could somebody please help me these 2 questions, as I am having a hard time implementing this?

 

I am building an event calender with php, javascript, html and css using the help of a tutorial.

 

The calender highlights the current day as red. When a booking has been made, the day of which the booking is made, turns navy.

 

Question 1

 

This was a success, when the insert form was attached to the calender page. But due to some bizarre working of the code, the form ends up becoming designed in the same manner as the calender. So for example, if the month row is coloured yellow and the day row is colored grey, then for some reason, the form with the first row becomes yellow and the second row becomes grey. Essentially, the form style is weirdly attached to the calender style. How can I stop this from happening?

 

Question 2

 

The second query, is that in order to a avoid the above, I tried redirecting the user to the event form on a separate page. While the event was successfully added to the database, when I go back to the calender page, the booking date is not turned navy as before. I need the date to turn navy again as before and also display the booking details, as question 1 did successfully.

As you can tell, I am really stuck here, and need some help (I would really love to implement the second question/scenario) but the first one is also fine for me. Please find the code below for each question. Thank you so much any help you can provide.

 

(I posted this question on stackoverflow, where you can find the code. Please find the link below. Thank you again)

 

https://stackoverflow.com/questions/46758993/event-calender-php

 

 

Link to comment
Share on other sites

Answer question 1:
You use the same styling on all table rows:
 

tr:nth-child(1) td:nth-child(2){
background-color: yellow;
}

tr:nth-child(2) td:nth-child(1n){
background-color: #D3D3D3;
}

You should give your calendar a class calendar and put it in your css

<!-- add class="calendar" to your table -->

<table border='1' class="calendar">
    <tr> <td> <input class="previousbutton" type='button' value='<'     name='previousbutton' onClick="goPreviousMonth (<?php echo     $month.",".$year?>)"> </td> 
         <td colspan='5'> <span class="title"> <?php echo $monthName."     ".$year; ?> </span> </td> 
         <td> <input class="nextbutton"  type='button' value='>'     name='nextbutton' onClick="goNextMonth (<?php echo $month.",".$year?>)">     </td> 
    </tr> 

 <tr> 
    <td>Sun</td> 
    <td>Mon</td> 
    <td>Tue</td> 
    <td>Wed</td> 
    <td>Thu</td> 
    <td>Fri</td> 
    <td>Sat</td> 
 </tr> <?php echo "<tr>"; 

....
.calendar tr:nth-child(1) td:nth-child(2){
background-color: yellow;
}

.calendar tr:nth-child(2) td:nth-child(1n){
background-color: #D3D3D3;
}
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.