Problem with mysql + PHP
Posted: Mon Dec 06, 2010 9:37 am
Hello, I am trying to get a variable from a form that posts to a mysql database to sort and post onto a page called events.php into a certain div tag depending on the month the chose when filling out the form? any help? its like they choose a month it posts to a database then displays in a div tag name January, or February... ect... depending on what month they chose..
Thanks for the help
Code: Select all
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
//Code goes here
//Set default open/close settings
$('.acc_container').hide(); //Hide/close all containers
$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
//On Click
$('.acc_trigger').click(function(){
if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
}
return false; //Prevent the browser jump to the link anchor
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="header">
</div><!--closes the header tag-->
<div id="sidebar">
</div><!--closes the sidebar tag-->
<div id="navigation">
<div id="navbox">
<div id="nav"><a href = "../index.html">Home</a></div>
<div id="nav"><a href = "Chaps-programs.html">Programs</a></div>
<div id="nav"><a href = "Chaps-events.php">Events</a></div>
<div id="nav"><a href = "Chaps-relatedlinks.html">Related Links</a></div>
<div id="nav"><a href = "chaps-howtohelp.html">How To Help</a></div>
<div id="nav"><a href = "chaps-contact.html">Contact Us</a></div>
</div><!-- closes the navbox div-->
</div><!--closes the navigation tag-->
<div id="content">
<div class = "drop">
<h2>Calendar of Events</h2>
<a href = "#">Drop In Center</a><br />
<a href = "#">Journey Center</a><br />
<a href = "#">(Upload Files)</a>
</div><!--closes the drop tag-->
<div class = "events">
<h2>Events</h2>
<a href = "#">Event Title</a><br/>
<a href = "#">Date (Start Date/End Date)</a><br/>
<a href = "#">Description</a><br/>
</div><!--closes the events tag-->
<div class = "didyou">
<h2>Did You Know</h2>
<a href = "#">Description</a><br/>
</div><!--closes the events tag-->
<div id="content3">
<div class="para2">
<h1>Chaps Events</h1>
<?php
//if the user has chosen a columns to sort by...
if (isset($_GET['sortcol'])){
//recieve the column nmae the user chose to sort by, and store it in a variable
$chosencol=$_GET['sortcol'];
}else{
//otherwise order by a default column...
$chosenID="eventID";
}
//make a connection to the server...connect("servername", "username", "password")
$link=mysql_connect("localhost","root", "");
//connect to our database...
$db= mysql_select_db("events");
//construct a sql query...
$query="select * from eventstable ORDER by month";
//run the query...
$result=mysql_query($query);
//for each row returned by our query do what is in {}
?>
<br />
<br />
<br />
<!------------------------- shows the months------------------------->
<h2>Click on Month to See Events</h2>
<div id="january">
<h2 class="acc_trigger"><a href="#">January</a></h2>
<div class="acc_container">
<div class="block">
This is where i want the post to display if the month chose was january
</div>
</div>
</div><br />
Thanks for the help