PHP - Textarea Not Displayed In Mysql Db
I've spent the past 2 days googling and trying different methods that people have recommended other people try yet still I come up with the same problem. I am new to coding and I am learning the basic functions so all feedback is welcome in aiding my learning endeavor. I am using a form and all of the inputs are submitting to the database other than the text area which comes up blank. I do not get an error when submitting the form I just get a blank value for the text area 'Comments'.
FORM
<form action="contactdb.php" method="post" form="contactdb"/>
Similar TutorialsHello everyone. I'm creating a website that has a sort of messaging system built in and I'm trying to get the information pulled out of the database to display exactly as it was typed. For example, if someone types this message: "This is the first line. This is the second line. And this is two lines below the second line." (By the way, when I view this message using phpMyAdmin, the message is displayed in the above format.) I would like to have the message displayed the same way when it is queried from the database. As of now, this is what I'm seeing instead: "This is the first line. This is the second line. And this is two lines below the second line." How can I achieve this? I would post the code that I'm using, but it's just a basic mysql query to get a variable "$message" then I'm just using echo "$message"; to put it on the page. Any help to point me in the right direction would be greatly appreciated. Thanks! Hello PHP geniuses, I'm having a bit of trouble here. I've built a WYSIWYG e-mail editor with the help of TinyMCE. I'm using a textarea to pull the innerHTML from the iframe where the actual editor is. The textarea will be hidden in production, but it's shown now for debugging reasons. I have a JS function that grabs the HTML from the iframe and puts it into the textarea, and this works great. The entire HTML gets populated in the textarea. When I go to save the e-mail (using a simple query that posts it and sends it straight to the database). The HTML is truncated in the database field to around ~255 characters. (it varies depending on what I have in there, but it's usually between 252 and 255) I really can't figure out why this would be cutting off like this. I've looked everywhere, I don't know what else to do. I wanted to add that the field is a text field in the database, that was the first and most obvious thing to check. I can confirm that my database holds the full text no problem. I can go into phpMyAdmin and copy+paste infinite amounts of data into the html field and it saves it without an issue. Thank you as always <3 If you need more information to help me, I will provide whatever helps. What's wrong with this code? Code: [Select] <textarea name="description" cols="60" rows="10"><?= $description ?></textarea> The textarea box returns null. Hello! I run into this simple problem and couldn't find any solutions from web, so I came here to ask you guys I don't understand what happens to linebreaks when I post textarea and save value to Mysql... Btw, I notided that linebreaks works properly if I don't use mysqli_real_escape_string, but I like to keep script as secure as possible... If I input this in to textarea: row1 row2 row4 row6 I get this in textarea and html-code: 1\r\n2\r\n3\r\n4\r\n5 This is how I try to do it: <? //>>> Connect to Mysql // Secure $_POST -data $_POST['mytext'] = mysqli_real_escape_string($db, $_POST['mytext']); // Insert to Mysql mysqli_query($db, "INSERT INTO mysql_table (mytext) VALUES ('$_POST[mytext]')"); // Get data from Mysql $query = mysqli_query($db, "SELECT mytext FROM mysql_table';"); $row = mysqli_fetch_array($query); mysqli_free_result($query); ?> <textarea name="mytext"><? print $row['mytext']; ?></textarea> <? // nl2br function $row['mytext'] = nl2br($row['mytext']); // print text echo $row['mytext']; ?> Hello, is it possible to insert somehow information from textarea to mysql? For example i have 3 lines in text area: John Tacker is a bad guy Tom Tacker has a big nose Ted Tacker is the same person as John Tacker and i want to insert them in table's different rows Hi Guys, I have a textarea on a html page with XXX amount of lines. How can I in php insert a separate mysqlrow for EACH line on the html textarea? Thanks G Hello to all, I have problem figuring out how to properly display data fetched from MySQL database in a HTML table. In the below example I am using two while loops, where the second one is nested inside first one, that check two different expressions fetching data from tables found in a MySQL database. The second expression compares the two tables IDs and after their match it displays the email of the account holder in each column in the HTML table. The main problem is that the 'email' row is displayed properly while its while expression is not nested and alone(meaning the other data is omitted or commented out), but either nested or neighbored to the first while loop, it is displayed horizontally and the other data ('validity', 'valid_from', 'valid_to') is not displayed.'
Can someone help me on this, I guess the problem lies in the while loop? <thead> <tr> <th data-column-id="id" data-type="numeric">ID</th> <th data-column-id="email">Subscriber's Email</th> <th data-column-id="validity">Validity</th> <th data-column-id="valid_from">Valid From</th> <th data-column-id="valid_to">Valid To</th> </tr> </thead> Here is part of the PHP code:
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ' <tr> <td>'.$row["id"].'</td> '; while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { echo ' <td>'.$row1["email"].'</td> '; } if($row["validity"] == 1) { echo '<td>'.$row["validity"].' month</td>'; }else{ echo '<td>'.$row["validity"].' months</td>'; } echo ' <td>'.$row["valid_from"].'</td> <td>'.$row["valid_to"].'</td> </tr>'; } ?>
Thank you. I have a form that generates html code, and displays it in a textarea with submit button. I want to submit button to take the data entered in that textarea1 on page 1, and upload to textarea2 on page 2 How can I do this? I have no idea where to start. This is driving me mad. I've looked in my books and on the Internet but I cannot find the answer. I have a form with a textarea and I need to retain the linebreaks. Obviously, before I send the data to MySQL, I run it through mysqli_real_escape_string and the result is: (In form) "Foo" Bar (In phpMyAdmin) \"Foo\"\r\nBar When I extract the data from MySQL, I use stripslashes($var) to get the quote back and end up with: "Foo"rnBar The problem I am having is changing the \r\n or rn to newlines so that it looks correct in the form. I have tried using nl2br before stripslashes. Even tried using str_replace to change the /r/n to <br /> but I just end up with "Foo"<br />Bar in the textarea box. There must be some simple thing that's causing the problem or people wouldn't be using textareas. Help! Hi, I am generating certificates in php i can display the name in arabic but it will not print on the certicate. It can show the English names though! is there a special code to be able to show that? code: <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <title>Certificate Generator</title> </head> <body> <center> <br><br><br> <h3>Certificate Generator</h3> <br><br><br><br> <form method="post" action=""> <div class="form-group col-sm-6"> <input type="text" name="name" class="form-control" id="name" placeholder="Enter Name Here..."> </div> <button type="submit" name="generate" class="btn btn-primary">Generate</button> </form> <br> <?php if (isset($_POST['generate'])) { $name = strtoupper($_POST['name']); $name_len = strlen($_POST['name']); if ($name == "" ) { echo " <div class='alert alert-danger col-sm-6' role='alert'> Ensure you fill all the fields! </div> "; }else{ echo " <div class='alert alert-success col-sm-6' role='alert'> Congratulations! $name on your excellent success. </div> "; //designed certificate picture $image = "certi.png"; $createimage = imagecreatefrompng($image); //this is going to be created once the generate button is clicked $output = "certificate.png"; //then we make use of the imagecolorallocate inbuilt php function which i used to set color to the text we are displaying on the image in RGB format $white = imagecolorallocate($createimage, 205, 245, 255); $black = imagecolorallocate($createimage, 0, 0, 0); //Then we make use of the angle since we will also make use of it when calling the imagettftext function below $rotation = 0; //we then set the x and y axis to fix the position of our text name $origin_x = 200; $origin_y=240; //we then set the x and y axis to fix the position of our text occupation $origin1_x = 120; $origin1_y=90; //we then set the differnet size range based on the lenght of the text which we have declared when we called values from the form if($name_len<=7){ $font_size = 25; $origin_x = 190; } elseif($name_len<=12){ $font_size = 30; } elseif($name_len<=15){ $font_size = 26; } elseif($name_len<=20){ $font_size = 18; } elseif($name_len<=22){ $font_size = 15; } elseif($name_len<=33){ $font_size=11; } else { $font_size =10; } $certificate_text = $name; //font directory for name $drFont = dirname(__FILE__)."/developer.ttf"; //function to display name on certificate picture $text1 = imagettftext($createimage, $font_size, $rotation, $origin_x, $origin_y, $black,$drFont, $certificate_text); imagepng($createimage,$output,3); ?> <!-- this displays the image below --> <img src="<?php echo $output; ?>"> <br> <br> <!-- this provides a download button --> <a href="<?php echo $output; ?>" class="btn btn-success">Download My Internship Certificate</a> <br><br> <?php } } ?> </center> <footer> <center><p>Built with ❤ by <a href="https://olawanlejoel.github.io/portfolio/">Olawanle Joel</a></p></center> </footer> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> </body> </html> Edited May 22, 2020 by ramiwahdan typo error I am trying to run a php code on my site but it kept on saying page cannot be found. Any idea why its saying that??? when I test this script on browser. This is all that I see. invalid username or password Code: [Select] <?php //start session session_start(); include 'functions.php'; if (loggedin()) { header("Location: userarea.php"); exit(); } if ($_POST['login']) { //get data $username = $_POST['username']; $password = $_POST['password']; $rememberme = $_POST['rememberme']; } if (username&&$password) { $login = mysql_query("SELECT * FROM users WHERE username='$username'"); while ($row = mysql_fetch_assoc($login)) { $db_password = $row['password']; if (md5($password)==$db_password) $loginok =TRUE; else $loginok = FALSE; if ($loginok ==TRUE); { if($rememberme=="on") setcookie("username",$username, time()+7200); else if ($rememberme=="") $_SESSION['username']=$username; header("Location: userarea.php"); exit(); } } } else { die("invalid username or password"); } ?> <form action="login.php" method="POST"> username:<br /> <input type="text" name="username" /><br /> password:<br /> <input type="password" name="password" /><br /> <input type="checkbox" name="rememberme">remember me<br /> <input type="submit" name="login" value="Log in" /> </form> so I am a beginner and have this very beginner-level PHP doubt. I have some basic code which is supposed to fetch the contents of a table and then display them in a table. What it's actually showing is the PHP code itself, instead of the table contents, in the browser. I'm using WAMP When I searched the net reasons given were 1. using short tags, and 2. some configuration problem. I haven't used short tags, and my wamp installation was done a long time back. Moreover this problem is not occuring all the time, even when I run the same code. Many thanks if anyone can suggest anything helpful. Sorry if I posted in the wrong place (new here). I want to output the data and also the buttons in my php codes. But i do not know why the buttons does not output as coded. Can anyone let me know where did my codes go wrong? I've been searching it but i cant't find the problem. Thanks in advance. <?php if(isset($_POST['invoice_details'])) { $discountsql = "INSERT INTO `invoice_price` (`order_id`) VALUES ('.$order_id.') "; $conn->query($discountsql); } ?> <?php $sql2 = " SELECT order_id FROM ordered_items GROUP BY order_id WHERE order_id = '".$row[order_id]."' "; $query2 = $conn -> query($sql2); while ($row2 = $query2 -> fetch_assoc()) { ?> <div class="col-12 form-group"> <p> <?php echo $row2['order_id']; ?></p> <p class="text-success" pointer-events="none" style="font-weight: bold; font-size: 25px; text-align:center; ">Your order is confirmed !</p> <a href="order-list.php"> <input class="btn btn-block checkoutbtn" type="button" name="invoice_details" value="Go to Order Page"> </a> </div> <?php } ?>
I have a very simple page, where I use the include statement that includes my connection string. The connection string and a variables are not being passed to my test server - (WAMP). My include file is below $server = "servername"; $username = "username"; $password = ""; $database = "dbname"; $portNumber = 3308; $link = mysqli_connect($server,$username,$password,$database,$portNumber); if(!$link) { echo "cannot connet to the server"; } else { echo "This works"; } echo "Hi"; I am including this file with the following code:
include ("includes/connect.inc");
My site is not connecting to the database, and is not displaying "This works", or "Hi". Do you have any pointers on how to get this connect?
At the moment i can retrieve information from a DB and display it nicely in a vertical line of boxes (some boxes with extra information as needed). I basically need a version of this with exactly the same information, but instead of a top-down list of divs (boxes), I need them to be displayed going around a circle (starting top centre, going clockwise). Does anyone know if this is possible? And how easy would it be? Any scripts? It's already taken me ages to get the list pulling the appropriate info and displaying in a straight line. Thanks for any help/direction. Added: The number of divs displayed will be variable depending on what's in the DB. So I can't count on their being a certain number. Therefore the 'circle' would need to re-size in some way?! Hey All, As of this morning our gallery has started to show the incorrect dates. Please go to: http://www.nightlifeguestlist.com/c...n/74/Carbon.htm you will see the first date is Fri, 29 October 10 this should be Sat, 30 October 10. In the database the date is in putted as 2010-10-30. The dates from Fri, 29 October 10 to Fri, 2 April 10 are all incorrect. These happen to be all BST times. While the dates for GMT are OK. The clocks here in the UK are now GMT and not BST. Has this anything to do with it? The code used is as follows: <? $location = false; if(isset($_GET['l'])){ $location = $_GET['l']; } $venue = false; if(isset($_GET['v'])){ $venue = $_GET['v']; } $event = false; if(isset($_GET['e'])){ $event = $_GET['e']; } $page = 0; if(isset($_GET['p'])){ $page = $_GET['p']; $page--; } $query_events = ""; if(!$location){ $query_events = "SELECT ec_venues.location FROM ec_venues GROUP BY ec_venues.location"; } else if($location && !$venue && !$event){ $query_events = "SELECT ec_venues.venue_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_id, ec_events.event_id,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_date IS NOT NULL AND ec_venues.location='".$location."' ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC LIMIT 0,1"; } else if($venue && !$event){ $query_events = "SELECT UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_name, ec_venues.venue_id, ec_events.event_id, ec_events.event_name,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_venues.venue_id=".$venue." ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC"; } else if($venue && $event){ $query_events = "SELECT ec_venues.venue_name, ec_events.event_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_events.image_folder, ec_venues.images_per_page,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_id=".$event." AND ec_venues.venue_id=".$venue.""; } mysql_select_db($database_nightlife2 , $nightlife2 ); // $query_events = "SELECT ec_venues.venue_name, ec_events.event_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_events.image_folder, ec_venues.images_per_page FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_id=".$event." AND ec_venues.venue_id=".$venue.""; //echo $query_events; $events = mysql_query($query_events, $nightlife2 ) or die(mysql_error()); $row_events = mysql_fetch_assoc($events); $totalRows_events = mysql_num_rows($events); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?=(!$location?"Elite Parties Photos":"Nightlife Guestlist @ ".$location." Club - ".$row_events['venue_name'])?></title> <link href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/style.css" rel="stylesheet" type="text/css" /> <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/IE-6.css" /> <![endif]--> <!--[if IE]> <link rel="stylesheet" type="text/css" href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/IE-8.css" /> <![endif]--> <? if($_SERVER['HTTP_HOST']=="elite"){?> <BASE HREF="http://elite/"> <? } else { ?> <BASE HREF="http://www.nightlifeguestlist.com/"> <? } ?> <SCRIPT language="JavaScript" src="/mircoFinestra.js"></script> <script src="/AC_RunActiveContent.js" type="text/javascript"></script> </style> </head> <body> <div class="wrapper"> <div id="head"> <div id="header"> </div> <!-- nav --> <div id="nav"> <div id="nav-area"> <ul> <li class='page_item current_page_item'><a href='http://www.nightlifeguestlist.com' title='Home'>Home</a></li><li class="page_item page-item-3"><a href="http://www.nightlifeguestlist.com/guest-lists" title="Guest Lists">Guest Lists</a></li> <li class="page_item page-item-5"><a href="http://www.nightlifeguestlist.com/photogallery.php" title="Photo Gallery">Photo Gallery</a></li> <li class="page_item page-item-7"><a href="http://www.nightlifeguestlist.com/video-gallery" title="Video Gallery">Video Gallery</a></li> <li class="page_item page-item-9"><a href="http://www.nightlifeguestlist.com/jobs" title="Jobs">Jobs</a></li> <li class="page_item page-item-11"><a href="http://www.nightlifeguestlist.com/membership" title="Mailing List">Mailing List</a></li> <li class="page_item page-item-16"><a href="http://www.nightlifeguestlist.com/tables" title="Tables">Tables</a></li> <li class="page_item page-item-13"><a href="http://www.nightlifeguestlist.com/event-management" title="Event Management">Event Management</a></li> <li class="page_item page-item-538"><a href="http://www.nightlifeguestlist.com/blog" title="Blog">Gossip Blog</a></li> </ul> </div> </div> <!-- end nav --> <div class="clear"></div> </div> <!--/head --> <div class="narrowcolumn"> <div class="entry"> <div id="content-area"> <!-- 1 --> <div id="section"> <? if($venue && !$event){ ?><?php $pCount = 0; $myNum = sprintf("%02d",$venue); echo "<img src='interiors/" . $myNum . "_logo.gif' vspace='2' hspace='2'>\n"; if ($handle = opendir('interiors')) { while (false !== ($file = readdir($handle))) { if (substr($file,0,6) == $myNum . "_pic") { echo '<img src="interiors/' . $file . '" vspace="2" hspace="2">'; if($pCount++ % 2 == 1) echo ""; } } closedir($handle); } ?> <? } ?> <? if(!$location){?> <!-- 2 --> <div id="section"> <? do{ $query_latest = "SELECT ec_venues.venue_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_id, ec_events.event_id FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ((ec_events.event_date) IS NOT NULL) AND ec_venues.location='".$row_events['location']."' ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC LIMIT 0,1"; $latest = mysql_query($query_latest, $nightlife2 ) or die(mysql_error()); $row_latest = mysql_fetch_assoc($latest); $totalRows_latest = mysql_num_rows($latest); ?> <a href="club_dates/<?=$row_events['location']?>/<?=$row_latest['venue_id']?>/<?=$row_latest['event_id']?>/<?=str_replace(" ","_",$row_latest['venue_name'])?>_page1.htm "><?=$row_events['location']?> - <?php echo date("l jS F",$row_latest['event_date']); ?> @ <?php echo $row_latest['venue_name']; ?></a><br> <? } while ($row_events = mysql_fetch_assoc($events)); mysql_free_result($latest); ?> </div> <!-- 3 --> <div id="section"> <? } else if(!$venue){ ?> </div> <!-- 4 --> <div id="section"> Our most recent event was <strong><a style="color:#000000; font-weight:bold;" href="club_dates/<?=$row_events['location']?>/<?=$row_events['venue_id']?>/<?=$row_events['event_id']?>/<?=str_replace(" ","_",$row_events['venue_name'])?>_page1.htm "><?php echo date("l jS F",$row_events['event_date']); ?> @ <?php echo $row_events['venue_name']; ?></a></strong> <? } else if($venue && !$event){?> </div> <!-- 5 --> <div id="section"> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="10"> <tr> <td colspan="4"><? if($totalRows_events==0){ ?> No photos are avaliable yet for this venue. <? } else { ?> Select a Date for <?php echo $row_events['venue_name']; ?> <? } ?> </td> </tr> <? $count = 0; do { if($count % 3 == 0){ echo '<tr>'; } ?> <td width="713"><a style="color:#000000; font-weight:bold;" href="club_dates/<?=$location?>/<?=$venue?>/<?=$row_events['event_id']?>/<?=str_replace(" ","_",$row_events['venue_name'])?>_page1.htm"><? echo ($row_events['event_date']==""?$row_events['event_name']:date("D, j F y",$row_events['event_date'])); ?></a></td> <?php if($count % 3 == 2){ echo "</tr>"; } $count++; } while ($row_events = mysql_fetch_assoc($events)); echo str_repeat("<td> </td>",4-($count % 4)); ?> </table> </div> <!-- 6 --> <div id="section"> <? } else if($venue && $event){ ?> </div> <!-- 7 --> <div id="section"> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td><? if ($dir = @opendir("photos/".$row_events['image_folder'])){ while (($file = readdir($dir)) !== false) { if(substr($file,0,4) == "page"){ $dirlist[] = $file; } } sort ($dirlist); reset ($dirlist); closedir($dir); } if ($dir = @opendir("photos/".$row_events['image_folder']."/".$dirlist[$page])){ while (false !== ($file = readdir($dir))) { if(substr($file,-3)=="jpg"){ $imglist[] = $file; } } usort($imglist,"strnatcmp"); reset ($imglist); closedir($dir); } $count = 0; $paging = ""; if($page==0){ $paging .= "<< "; } else $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($page).".htm' style='color:#000000; font-weight:bold;'><<</a> "; foreach($dirlist as $f){ if($page!=$count){ $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($count+1).".htm' style='color:#000000; font-weight:bold;'>".($count+1)."</a> "; } else { $paging .= ($count+1)." "; } $count++; } if($page==count($dirlist)-1){ $paging .= ">> "; } else $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($page+2).".htm' style='color:#000000; font-weight:bold;'>>></a>"; ?></td> </tr> <tr> <td><? echo "<table width='720'><tr><td>Nightlife Guestlist @ ".$row_events['venue_name'].($row_events['event_date']!="" ?" - ".date("l jS F Y", $row_events['event_date']) : "")." - ".$location."</td><td align='right'>".$paging."</td></tr></table>\n"; ?></td> </tr> <tr> <td><? for($count=0;$count<count($imglist);$count++){ echo "<a href='javascript:;'><img alt='".$imglist[$count]." @ ".$location." Club ".$row_events['venue_name'].", ".date("jS F Y", $row_events['event_date'])."' border='0' width='90px' height='60px' hspace='5px' vspace='5px' src='"."photos/".$row_events['image_folder']."/".$dirlist[$page]."/thumbs/".$imglist[$count]."' onclick='NewWindow(\"/popup.php?t=".count($imglist)."&n=".$count."&f=".$row_events['image_folder']."&p=".$dirlist[$page]."&title=".urlencode($location." Club ".$row_events['venue_name']." on ".date("jS F Y", $row_events['event_date']))."\",\"name\",\"600\",\"420\",\"no\");return false;'></a>\n"; if($count % 7 == 6){ echo "<br>\n"; } } ?> <? } ?></td> </tr> <tr> <td> </td> </tr> </table> </div> <div id="section"> <? if(!$location){ ?> <? } else { include("getClubLogos.php"); } ?> (Sorry for the amount of code!) I use the same code for another site on another server and it works fine. I guess I need to alter the code somehow? The gallery works ok just the dates show are wrong. Any ideas on how to fix this? The server settings/time seems are OK. The line which prints the date is:<? echo ($row_events['event_date']==""?$row_events['event_name']:date ("D, j F y", $row_events['event_date'])) ; ?> When I echo the date echo date('c'); I receive 2010-10-29T23:00:00+00:00 for Fri, 29 October 10. Thanks I have following error when i try to enter my student info into the database. ! ) Warning: Header may not contain more than a single header, new line detected. in C:\wamp\www\Student registration\new student registration\newStudentRegistrationFormvalidation.php on line 43 newStudentRegistrationFormvalidation.php <?php $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initial=$_POST['name_with_initial']; $date_of_birth=$_POST['date_of_birth']; $religion=$_POST['religion']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $grade_ID=$_POST['grade_ID']; $stream_ID=isset($_POST['stream_ID']) ? $_POST['stream_ID'] :''; $class_ID=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $currentdate=getdate(time()); $year=$currentdate["year"]; //admission number validation $answer=''; $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); $query="SELECT admission_no FROM student_info WHERE student_info.admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $answer=$row['admission_no'];} if($answer==0) { //line 43 header("location:student registrationDatabase.php?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); exit(); }else{ ?> <body> <?php echo "Admission number".$admission_no."This student has been alredy entered to the system ."."<BR>"."<BR>"."<BR>"; echo "<a href='newStudentRegistrationForm.php'>GO to manage student details page</a> "; exit(); }?> studentregistrationDatabase.php <?PHP $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initials=$_POST['name_with_initial']; $dob=$_POST['date_of_birth']; $religion=$_POST['religion']; //$gender=$_GET['gender']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $present_grade=$_POST['grade_ID']; $stream=$_POST['stream_ID']; $present_class=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $current=getdate(time()); $year=$current["year"]; $today = date("Y-m-d"); $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); //insert to database $query="select count(*) from student_info where admission_no='$admission_no'"; $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[0]==0) { $query="insert into student_info values(null,'$admission_no','$admission_date','$full_name','$name_with_initials','$dob','$religion','$address','$telephone','$grade_on_admission','$password','$student_house','$description_about_st')"; $result=mysql_query($query); if($stream!=null){ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class' and class.stream='$stream'"; }else{ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class'"; } $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $class_id=$row['class_id']; } $query="insert into student_class values('$admission_no','$class_id','$year')"; $result=mysql_query($query); if($payment=="2000") { $query="insert into payment_amount values(null,'2000','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); }else{ $query="insert into payment_amount values(null,'0','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); } header("location:../new student registration-parent details/studentRegistrationParentDetailsForm.php?admission_no=".$admission_no); exit(); } else{ ?> <?php echo "Admission number".$admission_no."This student has been already entered to the system"."<BR>"."<BR>"."<BR>"; echo "<a href='student registration.php'>GO to registration page</a>"; exit(); } ?> |