-
Trying to Centre Website in Browser
Bingo! Thanks
-
Trying to Centre Website in Browser
Simple I hope ... How do I get this website to be in the centre of the browser? http://www.narrevet.com/new/index.htm CSS file: http://www.narrevet.com/new/css/nwv.css Thanks for any help ...
-
timed slideshow from an images folder
Well I've managed to get the (phpshow.panmental.de): http://panmental.de/public/programming_pro...ipt%20in%20PHP/ to work. Except on the embeded pictures it is printing a white border. The frame is set to black but the white is inside this between the frame and the picture. I would like this to be black too. Is anyone familiar with this?
-
timed slideshow from an images folder
They're all a bit complicated ... is there anything a bit simpler. I can't get them to embed in my current webpage ... although I am sure they could do. Thanks ...
-
Drop down list with anchors
This should be simple but I'm not quite there. I want to create a drop down list to link to sections on the same page. Here is what I have so far: function make_genera_pulldown() { // Make the genre array: $genera = array (1 => '', 'ACOUSTIC', 'ALTERNATIVE', 'BLUES ROCK', 'DRUM AND BASE', 'ELECTRO', 'EMO', 'EXPERIMENTAL', 'FOLK', 'FUNK', 'GARAGE', 'GOTHIC', 'GRUNGE', 'HARDCORE', 'HIP-HOP', 'INDIE', 'JAZZ', 'MAGOO', 'METAL', 'NEW WAVE', 'POWERPOP', 'PROGRESSIVE', 'PUNK', 'RNB', 'SKA', 'WRONGPOP'); // Make the genre pull-down menu: echo '<select name="genera">'; foreach ($genera as $key => $value) { echo '<option><a href="#'.$value.'">'.$value.'</a></option>'; } echo '</select>'; } ?> Genre: <?php make_genera_pulldown(); ?> require_once (MYSQL); // Connect to the db. $q = "SELECT band_id, genera, band_name, music_description FROM band_members ORDER BY genera , band_name"; $r = mysqli_query($dbc, $q); $currentGenre = ''; while ($messages = mysqli_fetch_array($r, MYSQLI_ASSOC)) { if ($currentGenre != $messages['genera']) { echo "<a name=\"{$messages['genera']}\"><h2>{$messages['genera']}</h2></a>\n"; $currentGenre = $messages['genera']; } echo "<a href=bandinfo.php?id={$messages['band_id']}><h5> ".stripslashes($messages ['band_name'])."</h5></a><br /> ".stripslashes($messages['music_description'])." <br /><br />\n"; } mysqli_free_result ($r); // Free up the resources. mysqli_close($dbc); // Close the database connection. But it not quite working yet. Thanks for any help...
-
timed slideshow from an images folder
I hope this is simple. I want to create a random slide show of images from a designated folder (eg slideshow_images). I have found a number of slideshow codes but can't find one I can get to work from a folder of images. The idea is that users can upload images to this folder then they are displayed randomly as a slideshow ... Sounds simple huh? Has anyone got a code they can copy and paste that I can insert ... I'm assumeing PHP may be the best direction? Thanks for any help.
-
Entering Array Key and Value into Table
Phew. That took some time ... Thanks CWC, got there with your last bit of code ... Phew again, Big grins, Smileyboy
-
Entering Array Key and Value into Table
I think I can get the value to enter into the database as either a number of the month in words so I think the issue for me now is trying to display this in the 'gigs; page. Here the months are meant to be displayed once with the ilst of dates below for each gig. I think this is where I need to use the date("F",strtotime("December 2008 +".'month'."months")); function. Here is my page: require_once (MYSQL); // Connect to the db. $q = "SELECT month, day, band_name, venue, price, tickets_from, on_the_door FROM gigs ORDER BY month, day"; $r = mysqli_query($dbc, $q); $currentMonth = ''; while ($messages = mysqli_fetch_array($r, MYSQLI_ASSOC)) { if ($currentMonth != $messages['month']) { echo "<h2>{$messages['month']}</h2>\n"; $currentMonth = $messages['month']; } echo " {$messages['day']} ".stripslashes($messages['band_name'])." , ".stripslashes($messages['venue'])." "; if($messages['price']=='0'){ echo ", FREE"; } if($messages['price']=='999'){ echo ""; } elseif($messages['price']!=null){ echo ", £{$messages['price']}"; } if($messages['on_the_door']!=null){ echo " ".stripslashes($messages['on_the_door']).""; } if($messages['tickets_from']!=null){ echo ", get tickets at ".stripslashes($messages['tickets_from'])." "; } echo " <br /><br />\n"; } mysqli_free_result ($r); // Free up the resources. mysqli_close($dbc);
-
Entering Array Key and Value into Table
I think I am even more confused now (but thank you CityWebConsultants!). Here is all the code for the page which may make it a little clearer ... <?php # Update Gigs session_start(); if (!isset($_SESSION['user_id'])) { require_once ('includes/login_functions_a.inc.php'); $url = absolute_url(); header("Location: $url"); exit(); } require_once ('includes/config.inc.php'); $page_title = 'Add Gigs'; // This function makes a pull-down tickets from menu function make_tickets_pulldown() { // Make the tickets from array: $tickets_from = array (1 => '', 'the venue', 'Music Mania'); // Make the venue pull-down menu: echo '<select name="tickets_from">'; foreach ($tickets_from as $key => $value) { echo '<OPTION value="'.$value.'"> '.$value.'</option>'; // this causes the genera to be included rather than the key position } echo '</select>'; } // This function makes a pull-down on_the_door/pre sale menu function make_on_the_door_pulldown() { // Make the tickets from array: $on_the_door = array (1 => '', 'On the Door', 'Pre Sale'); // Make the venue pull-down menu: echo '<select name="on_the_door">'; foreach ($on_the_door as $key => $value) { echo '<OPTION value="'.$value.'"> '.$value.'</option>'; // this causes the genera to be included rather than the key position } echo '</select>'; } // This function makes a pull-down venue menu function make_venue_pulldown() { // Make the venues array: $venue = array (1 => '', 'Fatcats', 'The Glebe', 'Riggers', 'Satchmos', 'The Sugarmill', 'The Underground'); // Make the venue pull-down menu: echo '<select name="venue">'; foreach ($venue as $key => $value) { echo '<OPTION value="'.$value.'"> '.$value.'</option>'; // this causes the genera to be included rather than the key position } echo '</select>'; } // This function makes a pull-down DAY menu function make_day_pulldown() { // Make the day array: $day = array (1 => '', '1', '2', '3', '4', '5', '6', '7', '8', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'); // Make the dAY pull-down menu: echo '<select name="day">'; foreach ($day as $key => $value) { echo '<OPTION value='.$value.'> '.$value.''; // this causes the genera to be included rather than the key position } echo '</select>'; } // This function makes three pull-down menus // for selecting a month, day, and year. function make_month_pulldown() { // Make the months array: $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); // Make the months pull-down menu: echo '<select name="month">'; foreach ($months as $key => $value) { // echo '<OPTION value='.$value.'> '.$value.''; echo "<OPTION value='".$key."'> ".$value."</OPTION>"; } echo '</select>'; } // Check if the form has been submitted: if (isset($_POST['submitted'])) { require_once (MYSQL); // Connect to the db. // Trim all the incoming data: $trimmed = array_map('trim', $_POST); // Assume invalid values: $bn = $da = $mo = $v = $pr = $otd = $tf = FALSE; // Check for a band name assumes only letters: if (preg_match ('/^[A-Z0-9 \'.-\\\]{2,100}$/i', $trimmed['band_name'])) { $bn = mysqli_real_escape_string ($dbc, $trimmed['band_name']); } else { echo '<p class="error">Please enter the band\'s name</p>'; } // Check for a month: if (preg_match ('/^\w{1,10}$/', $trimmed['month'])) { $mo = mysqli_real_escape_string ($dbc, $trimmed['month']); } else { echo '<p class="error">Please enter a valid month</p>'; } // Check for a year: if (preg_match ('/^\w{1,2}$/', $trimmed['day'])) { $da = mysqli_real_escape_string ($dbc, $trimmed['day']); } else { echo '<p class="error">Please enter a valid date</p>'; } // Check for venue assumes only letters: if (preg_match ('/^[A-Z0-9 \'.-\\\]{2,20}$/i', $trimmed['venue'])) { $v = mysqli_real_escape_string ($dbc, $trimmed['venue']); } else { echo '<p class="error">Please enter the venue</p>'; } if (preg_match ('/^\d\.{1,5}$/', $trimmed['price'])) { $pr = mysqli_real_escape_string ($dbc, $trimmed['price']); } else { $pr = mysqli_real_escape_string ($dbc, '999'); } // Check for on the door : if (preg_match ('/^[A-Z0-9 \'.-\\\]{0,100}$/i', $trimmed['on_the_door'])) { $otd = mysqli_real_escape_string ($dbc, $trimmed['on_the_door']); } // Check for tickets from : if (preg_match ('/^[A-Z0-9 \'.-\\\]{0,100}$/i', $trimmed['tickets_from'])) { $tf = mysqli_real_escape_string ($dbc, $trimmed['tickets_from']); } if ($mo && $bn && $da && $v) { // If everything's OK... // Make the query: $q = "INSERT INTO gigs (venue, month, day, band_name, price, on_the_door, tickets_from) VALUES ('$v', '$mo' '$da', '$bn', '$pr', '$otd', '$tf' )"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if (mysqli_affected_rows($dbc) == 1) { // Print a message: echo '<h1>Thank you</h1> <p>Gig added. You may continue to add further gigs below.</p><p><br /></p>'; } else { // If it did not run OK. // Public message: echo '<h1>System Error</h1><p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>'; } } } ?> <h1>Add a Gig</h1> <form action="add_gigs.php" method="post"> <fieldset> <p><b>Band Name:</b> <input type="text" name="band_name" size="20" maxlength="100" value="" /></p> <p>Month: <?php make_month_pulldown(); ?> </p> <p>Date: <?php make_day_pulldown(); ?> </p> <p>Venue: <?php make_venue_pulldown(); ?> </p> <p><b>Price:</b> <input type="text" name="price" size="5" maxlength="5" value="" /></p> <p>Pre Sale?: <?php make_on_the_door_pulldown(); ?> </p> <p>Tickest From: <?php make_tickets_pulldown(); ?> </p> <p></p> </fieldset> <div align="center"><input type="submit" name="submit" value="Add Gig" /></div> <input type="hidden" name="submitted" value="TRUE" /> </form>
-
Entering Array Key and Value into Table
Thanks Jamest for that fast responce. Where do I insert this code? I'm getting errors saying Undefined Variable: months.... Thanks again?
-
Entering Array Key and Value into Table
Still struggling with this so will try a different tact: I want to enter the month and the associated key into the table from the following drop down (into a different column in the db). This is what I have so far which enters the month as words only, but I'm not sure how to enter the key too: function make_month_pulldown() { // Make the months array: $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); // Make the months pull-down menu: echo '<select name="month">'; foreach ($months as $key => $value) { echo '<OPTION value='.$value.'> '.$value.''; } echo '</select>'; } There's a bit more validation but you get the idea of entering to the database: if (isset($_POST['submitted'])) { $mo = mysqli_real_escape_string ($dbc, $trimmed['month']); } $q = "INSERT INTO gigs (venue, month, month_id, day, band_name, price, on_the_door, tickets_from) VALUES ('$v', '$mo', '$mid' '$da', '$bn', '$pr', '$otd', '$tf' )"; Thanks for any help ...
-
using ORDER BY to get months in order
Sorry for being so dim on this, but I still can't get it working. Here is what I have so far but it is erroring (does not like '$month'). The table is called 'gigs' and the month is stored in the 'month' column as a number: require_once (MYSQL); // Connect to the db. $q = "SELECT month, day, band_name, venue, price, tickets_from, on_the_door FROM gigs ORDER BY month, day"; $r = mysqli_query($dbc, $q); $months = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'); $currentMonth = ''; while ($messages = mysqli_fetch_array($r, MYSQLI_ASSOC)) { if ($currentMonth != $messages[$month]) { echo "<h2>{$messages[$month]}</h2>\n"; $currentMonth = $messages[$month]; } echo " {$messages['day']} ".stripslashes($messages['band_name'])." , ".stripslashes($messages['venue'])." "; if($messages['price']=='0'){ echo ", FREE"; } Again, thanks for everything
-
using ORDER BY to get months in order
Don't I have to define what the $month_number represents somewhere? (if so how?)
-
using ORDER BY to get months in order
Ok, I have changed the input to the database to numbers 1-12 for each month. Now when I display them I want to show January not 1, what is the simplest code for this? This is what I have so far: $q = "SELECT month, day, band_name, venue FROM gigs ORDER BY month, day"; $r = mysqli_query($dbc, $q); $currentGenre = ''; while ($messages = mysqli_fetch_array($r, MYSQLI_ASSOC)) { if ($currentMonth != $messages['month']) { echo "<h2>{$messages['month']}</h2>\n"; $currentMonth = $messages['month']; } But it is printing 1 not January etc ... Thanks for any help ...
-
using ORDER BY to get months in order
bummer I thought that might be the best way ... will get onto it ... sometime ... thanks very much