tom7890 Posted January 19, 2015 Share Posted January 19, 2015 i need a form that is hidden until the user clicks a button on a calendar only Then the form will be visible and have a field for the day that way pressed on submit the form would go back to being invisible. not sure how to implement this can anyone help Quote Link to comment https://forums.phpfreaks.com/topic/294074-forms-php/ Share on other sites More sharing options...
ginerjm Posted January 19, 2015 Share Posted January 19, 2015 If it has to happen without refreshing the screen you probably are talking about using a js function to capture the value and then make an ajax call that passes the value to a php script that will generate your html and then paste it into your hidden div and then make the div visible. Quote Link to comment https://forums.phpfreaks.com/topic/294074-forms-php/#findComment-1503458 Share on other sites More sharing options...
Barand Posted January 19, 2015 Share Posted January 19, 2015 (edited) Replacing the current <script> with this in the code I posted in your other thread will do it <script type="text/javascript"> //******************************************** // Create the on-click function for each // clickable cell (class = day) // to resubmit the page with clicked date //******************************************** <?php if (isset($_GET['date'])) { echo "var formvis = \"visible\";" ; } else { echo "var formvis = \"hidden\";" ; } ?> $().ready(function(){ $(".form").css("visibility",formvis); $(".day").click(function(){ location.href="?date="+$(this).attr("id"); }) }) </script> Edited January 19, 2015 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/294074-forms-php/#findComment-1503473 Share on other sites More sharing options...
tom7890 Posted January 19, 2015 Author Share Posted January 19, 2015 <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "<tr> "; if($i < $startday) echo "<td></td> "; else echo "<td align='center' valign='middle' height='20px'><a href='timeslots.html'>". ($i - $startday + 1) . "</a></td> "; if(($i % 7) == 6 ) echo "</tr> "; } ?> how do i change this??? Quote Link to comment https://forums.phpfreaks.com/topic/294074-forms-php/#findComment-1503474 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.