PHP - Header May Not Contain More Than A Single Header, New Line Detected.
Hello everyone, I'm just starting out with PHP as I need to create an online bookstore for a school project. I'm working by a magazine which should teach you exactly how to do this using PHP, but I've had a bunch of problems with the code they use and I don't really know what's going on. Anyway, this looks really simple and basically what it does is allows you to post a comment on a book, then returns you to the book's page. Problem is, I'm getting the Header may not contain more than a single header, new line detected. error and I can't figure out why. I've tried researching into the matter but all the cases I found had to do with returning to an url, which is not my case.
Anyway, here's the snippet of code: The form: Code: [Select] <div style="width:400px; border:1px solid #ffffff; background-color:#F9F1E7; padding:5px"> <b>Adauga opinia ta:</b> <hr size="1"> <form action="adauga_comentariu.php" method="POST"> Nume: <input type="text" name="nume_utilizator"><br><br> Email: <input type="text" name="adresa_email"><br><br> Comentariu: <br> <textarea name="comentariu" cols="45"></textarea><br><br> <input type="hidden" name="id_carte" value="<?=id_carte?>"> <center><input type="submit" value="Adauga"</center> </form> </div> The script adaugare_comentariu.php: Code: [Select] <?php ob_start(); include("conectare.php"); $numeFaraTags=strip_tags($_POST['nume_utilizator']); $emailFaraTags=strip_tags($_POST['adresa_email']); $comentariuFaraTags=strip_tags($_POST['comentariu']); $sql="insert into comentarii (id_carte, nume_utilizator, adresa_email, comentariu) values(".$_POST['id_carte'].", '".$numeFaraTags."','".$emailFaraTags."','".$comentariuFaraTags."')"; mysql_query($sql); $inapoi="carte.php?id_carte=".$_POST['id_carte']; header("location:urldecode($inapoi)"); ob_end_flush(); ?> conectare.php connects to the mysql database. $inapoi is the variable which returns the user to carte.php (the book he posted a comment on), where id_carte is the book's unique id. I'm getting Header may not contain more than a single header, new line detected on line ten, which is the header line. Can anyone help me? I've been stumped on this for a few days now and I've just let it pass and started working on other bits, but it's bugging me too much and I'd like to fix it. Similar TutorialsThis topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=350027.0 Hi All, I'm trying to debug my first few lines of PHP where I have all my "checks" to make sure someone is logged in. I have this code all by itself and it is still not executing. This is the only page that I'm having trouble with. header('Location: login.php?logout=1'); Hello, I have a syntax error on line 203 that is causing my code NOT work. Could someone please look at it and tell me what is wrong & more important how to fix it? Below is what I am getting. This " ~ " is server path info " Parse error: syntax error, unexpected $end in /~ /~ /~ /phptestform/real_form_processing.php on line 203" Also, how do I prevent "header injection", to keep my mail form from being open to abuse by spammers? thanks mrjap1 Code: [Select] <?php # Script if (isset($_POST['submit'])) { // Handle the form. // Register the user in the database. require_once ('mysql_connect_page.php'); // Connect to the db. // Create a function for escaping the data. function escape_data ($data) { global $dbc; // Need the connection. if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } return mysql_real_escape_string($data, $dbc); } // End of function. $message = NULL; // Create an empty new variable. // Check for a first name. if (empty($_POST['first_name'])) { $fn = FALSE; $message .= '<p>You forgot to enter your first name... its Required!</p>'; } else { $fn = escape_data($_POST['first_name']); } // Check for a last name. if (empty($_POST['last_name'])) { $ln = FALSE; $message .= '<p>You forgot to enter your last name... its Required!</p>'; } else { $ln = escape_data($_POST['last_name']); } // Check for an email address. if (empty($_POST['email'])) { $e = FALSE; $message .= '<p>You forgot to enter your email address... its Required!</p>'; } else { $e = escape_data($_POST['email']); } // Check for a address. if (empty($_POST['address'])) { $u = FALSE; $message .= '<p>You forgot to enter your address... its Required!</p>'; } else { $u = escape_data($_POST['address']); } // Check for a country. if (empty($_POST['country'])) { $u = FALSE; $message .= '<p>You forgot to enter your country... its Required!</p>'; } else { $u = escape_data($_POST['country']); } if ($salutation && $first_name && $last_name && $address && $city && $state_province && $zip_code && $email && $zip_code && $newsletter && $registration_date ) { // If everything's OK. $query = "SELECT id FROM visitors WHERE address='$address'"; $result = @mysql_query ($query); // Run the query. if (mysql_num_rows($result) == 0) { // Make the query. This code is what you will use to prevent duplicate of usernames $query = "INSERT INTO `mrjap1_database`.`visitors` (`id` , `salutation` , `first_name` , `last_name` , `address` , `city` , `state_province` , `zip_code` , `country` , `email` , `newsletter` , `registration_date`) VALUES ( NULL , '$_POST[salutation]', '$_POST[first_name]', '$_POST[last_name]', '$_POST[address]', '$_POST[city]', '$_POST[state_province]', '$_POST[zip_code]', '$_POST[country]', '$_POST[email]', '$_POST[newsletter]', '$_POST[registration_date]' , NOW() )"; $result = @mysql_query ($query); // Run the query. if ($result) { // If it ran OK. exit(); // Quit the script. } else { // If it did not run OK. $message = '<p>You could not be registered due to a system error. We apologize for any inconvenience.</p><p>' . mysql_error() . '</p>'; } mysql_close(); // Close the database connection. } else { $message .= '<p>Please try again.</p>'; } } // End of the main Submit conditional. // Print the error message if there is one. if (isset($message)) { echo '<font color="red">', $message, '</font>'; } ?> <?php // ALL THE SUBJECT and EMAIL VARIABLES $emailSubject = 'MY TEST EMAIL SCRIPTING!!! '; $webMaster = 'myemailaddress@gmail.com'; // GATHERING the FORM DATA VARIABLES $salutation = $_POST['salutation']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $address = $_POST['address']; $city = $_POST['city']; $state_province = $_POST['state_province']; $zip_code = $_POST['zip_code']; $country = $_POST['country']; $email = $_POST['email']; $newsletter = $_POST['newsletter']; $registration_date = $_POST['registration_date']; $date = date ("l, F jS, Y"); $time = date ("h:i A"); $body = <<<EOD <br /><hr><br /> <strong>Salutation: </strong>$salutation <br /> <strong>First Name:</strong>$first_name <br /> <strong>Last Name: </strong>$last_name <br /> <strong>Address: </strong>$address <br /> <strong>City: </strong>$city <br /> <strong>State_Province: </strong>$state_province <br /> <strong>Zip Code: </strong>$zip_code <br /> <strong>Country: </strong>$country <br /> <strong>Email:</strong> $email <br /> <strong>Zip Code:</strong> $zip_code <br /> <strong>Newsletter:</strong> $newsletter <br /> <strong>Registration Date:</strong> $date at $time <br /> EOD; // THIS SHOW ALL E-MAILED DATA, ONCE IN THE E-MAILBOX AS READABLE HTML $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); // THE RESULTS OF THE FORM RENDERED AS PURE HTML $theResults = <<<EOD <!DOCTYPE HTML> <html lang="en"> <head> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; } #thankyou_block { width: 400px; height: 250px; text-align:center; border: 1px solid #666; padding: 5px; background-color: #0CF; border-radius:8px; -webkit-border-radius:8px; -moz-border-radius:8px; -opera-border-radius:8px; -khtml-border-radius:8px; box-shadow:0px 0px 10px #000; -webkit-box-shadow: 0px 0px 10px #000; -moz-box-shadow: 0px 0px 10px #000; -o-box-shadow: 0px 0px 10px #000; margin: 25px auto; } p { font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; letter-spacing:1px; color: #333; } </style> <meta charset="UTF-8"> <title>THANK YOU!!!</title> </head> <body> <div id="thankyou_block"> <br><br><br> <h1>CONGRATULATIONS!!</h1> <h2>YOUR FORM HAS BEEN PROCESSED!!!</h2> <p>You are now registered in our Database...<br> we will get back to you very shortly.<br> Please have a very wondeful day.</p> </div> </body> </html> EOD; echo "$theResults"; ?> I need to get the 2nd code working. Please help. This works $query = "SELECT DISTINCT addressz FROM abs WHERE statez = 'AZ'"; $results = mysql_query($query); But this dosen't. $SomeVar = $_POST['disloc']; $query = "SELECT DISTINCT addressz FROM abs WHERE statez = '".$SomeVar."' ORDER BY addressz ASC"; $results = mysql_query($query); This sounds like it should be pretty simple but I've looked for a while and I'm having trouble finding an answer. What I have is a simple table with 3 columns with predetermined widths. When the text that is queried from the database is inserted into the table, and the text string is longer than the column width, it pushes the text to a second line, which throws the whole table out of whack. Instead, I want the text to be cut off before going to the next line. For example: This is what is happening: This is a sample string of text. This is what I'm trying to do: This is a sample string... Can anyone tell me where to find the solution to this problem? Not that it's needed, but here is some simple code that I'm working with: Code: [Select] <?php $message = "This is a sample string of text."; echo "<table width=\"150\" height=\"20\"border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"50\" height=\"20\" align=\"left" valign=\"top\">Column 1</td>"; echo "<td width=\"50\" height=\"20\" align=\"left" valign=\"top\">Column 2</td>"; echo "<td width=\"50\" height=\"20\" align=\"left" valign=\"top\">$message</td>"; echo "</tr>"; echo "</table>"; ?> Hi, I'm modifying the following PHP code from a Wordpress plugin: /* Byline. */ if ( $instance['byline'] ) echo do_shortcode( "<p class='byline'>{$instance['byline']}</p>" ); /* Entry title. */ if ( 'widget' !== $instance['entry_container'] && $instance['entry_title'] && $show_entry_title ) { the_title( "<{$instance['entry_title']} class='entry-title'><a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a></{$instance['entry_title']}>" ); } elseif ( 'widget' !== $instance['entry_container'] && $show_entry_title ) { the_title( "<a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a>" ); } The output currently is: Code: [Select] [ December 13, 2010 ] Post Title I'm trying to combine the two so that the output appears on one line. What is the operator to execute multiple command in one statement? Thanks. Hi, I am pretty much a new newbie when it comes to PHP, and have a problem that I need to solve, for a website that has to go live tomorrow. Basically I have been using a javascript upload script called 'uploadify' which had an option for the upload folder which was added to the script in the form: Code: [Select] 'folder' : '/songs/<?php echo $_SESSION["name"];?>', I added the php echo to return the username from a PHP login, so it gets added to the path to the upload folder (each user has their own subfolder for uploading to). With the new version of the uploadify script, the folder option has been moved to a separate PHP file where it is now in the form: Code: [Select] $targetFolder = '/songs/'; I need to find a way of adding the username variable to this line. I have tried using echo in various ways, and googled about, but it has stumped me, simple as it may be. If anyone could let me know how I construct this line I'd be very grateful. Time is of the essence, as they say... Thanks, Nick I'm ok with PHP but probably not half as good as some of you guys on here. I am basically trying to find a way to grab a line from a huge and I mean huge text file.... its basically a list of keywords I want to call by line number but without preferably going through them all before I get to that line.....otherwise couldmcrash my server obviously. At the moment im using this Code: [Select] $lines = file('http://www.mysite.com/keywords.txt'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { echo "$line_num"; } This works but im sure theres gotta be a better way of doing to save on usuage because this is putting the whole file into the memory and if I can simply say to php give me line number 97, would umm RULE.... Hope you guys can come up with a solution as your much smarter than me ty Hi everyone, I have a login area, and i also have set up for me is a view page... the view page is each user's sort of profile, it gets id and displays relevant content. i was wondering if i could get the id or post rather through a re-direct on log in? for example user logs in with username and password, user is re-directed to the view page like this: header( "refresh:5;url=view00=id.php " ); echo '<h1>You will be re-directed in 5 seconds...</h1>'; user is taken to view page where they can edit bit on it. So far though i'm getting page not found error? first of all is this possible? if not whats the correct way/better way? Thanks Can some one help please i always get this wrong dont now why keep saying header already been sent any help please and how to fix it Code: [Select] <?php session_start(); $conn = mysql_connect(""); $db = mysql_select_db("", $conn); if(isset($_POST['submit'])){ $user = mysql_escape_string($_POST['user']); $pass = mysql_escape_string($_POST['pass']); } if(empty($user) && empty($pass)){ exit; }else{ } ?> <?php $sql = mysql_query("SELECT * FROM useradmin WHERE dbusername= '".$user."' AND dbuserpass= '".$pass."'")or die(mysql_error()); $row = mysql_fetch_assoc($sql); $count = count($sql); $u = $row['dbusername']; $p = $row['dbuserpass']; if($u == $user && $p == $pass){ $_SESSION['access'] = "$u"; header("location: index.php"); }else { echo "Sorry there as been a problem!"; exit; } ?> How do I get this to put in the pilotID? Code: [Select] header("Location: logbook.php?id=" . $pilotid); Thanks! Hey guys, I have a problem, i'm using ob_start to send multiples headers and it works but the problem is that my metada is not being sent, when i remove the ob_start it gets sent. Is there a way i can allow more info to be sent with ob_start? or should i use other methods to redirect to pages? i dont want to use javascript or meta http because they are not very reliable is there any other way? Thanks for help. Hi is there a way that i can set header not go anywhere like the problem with this is that it still goes to the second header is there a way i can set if none do nothing exit? and else do the second header?? Code: [Select] <?php if ($_POST['agents']=="none") { header("location:#"); exit; // header("Location: {$_SERVER['PHP_SELF']}"); } else { header("location:http://www.xxxxxx.co.uk/tv/".$_POST['agents']."/index.php"); } ?> Hi there, I have a form which displays a "successful" message if the form is completed correctly. However, I want the form to go to another url if it is successful. I have tried this, but I get the "headers already sent..." message // Add New Subscriber Success Message $successMsg = header('Location: http://www.example.com/'); is there another way to forward onto another page? Thanks I want to set the correct header / cache values for a site. I am working on a social network / forum style site. I want to ensure that every page a user requests results in a fresh one being requested from the server as most content changes by the minute. (1) How would I set this? (2) Also, can I prevent nav bars being reloaded as these never, ever change. Hi all,
I am not sure why my header is not displaying the header image after using the CSS
I have a png file that repeats horizotally.
Please help
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Wikigets The online store</title> <style type="text/css"> body { margin:0 px;} #pageTop { background: url(style/headerline1.png); height:110 px; } </style> </head> <body> <div id="pageTop"> </div> <div id="pageMiddle"></div> <div id="pageBottom"></div> </body> </html> headerline1.png 2.82KB 0 downloads headerline1.png 2.82KB 0 downloads Hi, I'm a newbie, and needed help fixing a part of a code Whenever someone is clicking add to cart, it triggers an error. The output is: Duplicate entry Warning: Cannot modify header information - headers already sent by (output started at C:\ampp\htdocs\ptc1\pages\insertTotempsql.php:9) in C:\ampp\htdocs\ptc1\pages\insertTotempsql.php on line 56 Is there some weakness in the code causing it? line 56 is the last line. The code is <?php if( !isset( $_SESSION )){ session_start(); } $ses_id = session_id(); require_once('../Connections/connect.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php if(isset($_POST['id'])){ $id=$_POST['id']; $uom=$_POST['uom']; $quantity=$_POST['QUANTITY']; $date=$_POST['dateToday']; $PRICE=$_POST['PRICE']; if(isset($_POST['MeatOrigin'])){ $prod=$_POST['prodname'] . " ( " . $_POST['MeatOrigin'] . " ) "; } else { $prod=$_POST['prodname']; } mysql_select_db($database_connect, $connect); //check database if item is existing $query_duplicate = sprintf("SELECT * FROM tbl_cart WHERE pd_id='$id' and ct_session_id='$ses_id' and ct_date='$date'"); $duplicate = mysql_query($query_duplicate, $connect) or die(mysql_error()); $row_duplicate = mysql_fetch_assoc($duplicate); $totalRows_duplicate = mysql_num_rows($duplicate); if($totalRows_duplicate > 0){ echo "Duplicate entry"; } else { $insertSQL = "INSERT INTO tbl_cart ( pd_id, pd_name, ct_qty, ct_session_id, ct_date, PRICE, uom) VALUES ('$id', '$prod', '$quantity', '$ses_id', '$date', '$PRICE', '$uom')"; $Result1 = mysql_query($insertSQL, $connect) or die(mysql_error()); } mysql_close($connect); header("Location:".$_SERVER['HTTP_REFERER']); } ?> Thanks I am trying to redirect the user to a different Web site after they enter a password. I have two problems, I think. a. My phone file is not retrieving the 'input' from my html5 form. b. My phone header is not working: header (' location: http://filefippo.com'); What is wrong with my coding? <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="keywords" content="html"> <meta http-equiv="refresh" content "1800"> <link rel="stylesheet" href="menu_blue.css" type="text/css" media="screen" /> <title>Members 2</title> <script src="http://1.2.3.4/bmi-i...sion=1350564613" language="javascript"> </script> <!--[if IE 6]> <style> body {behavior: url("csshover3.htc");} #menu li .drop {background:url("img/drop.gif") no-repeat right 8px; </style> <![endif]--> </head> <body bgcolor="#000080"> <ul id="menu"> <li> <a href="index.html">Home</a> <!-- Home page --> </li> <!-- End Home page --> <li> <a href="contactform.html">Contact</a> <!-- Contact page --> </li> <!-- End Contact page --> <li> <a href="feedbackform.html">FeedBack</a> <!-- Feedback Page --> </li> <!-- End Feedback page --> <li> <a href="construc.html">Free Estimate</a> <!-- Free Estimate Page --> </li> <!-- End Free Estimate page --> <li> <a href="construc.html">Humor</a> <!-- Humor Page --> </li> <!-- End Free Humor page --> <li> <a href="#" class="drop">Other Links</a> <!-- Other Links Page --> <div class="dropdown_1column align_right"> <div class="col_1"> <ul class="simple"> <li> <a href="construc.html"> Members</a></li> <li> <a href="military.html"> Military</a></li> </ul> </div> </div> </li><!-- End Other Links page --> <li> <a href="repair_upgradeform.html">Repair/Upgrade</a> <!-- Repair/Upgrade Page --> </li><!-- End Repair/Upgrade page --> <li class="menu_right"> <a href="#" class="drop">Training</a> <!-- Training Page --> <div class="dropdown_1column align_right"> <div class="col_1"> <ul class="simple"> <li> <a href="tng_appsform.html"> Applications</a></li> <li> <a href="tng_hardwareform.html"> Hardware</a></li> <li> <a href="tng_osform.html"> Operating Systems</a></li> </ul> </div> </div> </li><!-- End Training page --> </ul> <br> <form name="myform" method="post" action="members2.php"> <table width="100%" align="center" bgcolor="#000080"> <tr> <th align="center" > <font size="+2" color=#ffff00"> ~ ~ ~ Member ~ ~ ~ </font> <br> </th> </tr> </table> <br> <table width="699" bgcolor="#000080" align="center"> <tr align="center"> <td align="center"> <input type="password" name="password" maxlength="15" size="15"> </td> </tr> </table> <table width="699" bgcolor="#000080" align="center"> <tr align="center"> <td align="center"> <font color="#ffffffff" size="+1"> (Please enter the password on your receipt) </font> </td> </tr> </table> <br> <table width="669" bgcolor="#000080" align="center"> <tr> <td align=center> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> //You should create the validator only after the definition of the HTML form var frmvalidator = new Validator("myform"); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("Password","req","Please enter the Password."); frmvalidator.addValidation("Password","maxlen=15","Max length for the Password is 15"); frmvalidator.addValidation("Password","alnum_s","Password - Alphabetic and Numeric chars"); </script> </body> </html> <script language="javascript"><!--//bmi_orig_img 0 // --> </script> PHP CODE <?php ob_start(); // Process membersform2.html error_reporting(-1) ; // Get Data From Form if ($_SERVER["REQUEST_METHOD"] == "POST") { if(isset($_POST["password"])) { $password = $_POST["passwords"]; trim($password); echo "$Password"; } else { if(empty($_POST["password"])) { echo "Password is required"; } } } // Validate Pwd if($password == "Z0y1X2w3V"){ header(' Location: http://filehippo.com/ '); exit; }else { members(); } // FUNCTION function members(){ // Print to browser global $password; // echo " <html>\n"; echo " <head>\n"; echo " <title>Redirect</title>\n"; echo " </head>\n"; echo " <body BGCOLOR=\"#000080\" TEXT=\"#ffff00\">\n"; echo " <table width=\"600\" Align=\"center\">\n"; echo " <tr>\n"; echo " <td width=\"600\" Align=\"left\">\n"; echo " You will be redirected to the members page in a moment.\n"; echo " <br />\n"; echo " $password \n"; echo " <br /><br />\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </body>\n"; echo " </html>"; } ob_flush(); ?> As the title says, my headers not redirecting. Login.php: <?php include("global.php"); if (isset($_POST['login'])) { // Form data $email = $_POST['email']; $password = $_POST['password']; // If email and password are both filled in if ($email && $password) { mysql_select_db("social_site") or die("Can\'t find database!"); $query = mysql_query("SELECT * FROM users where email = '$email'"); $numrows = mysql_num_rows($query); // If email in database if ($numrows != 0) { // Login while ($row = mysql_fetch_assoc($query)) { $dbemail = $row['email']; $dbpassword = $row['password']; } if ($email == $email && $password == $dbpassword) { // User is logged in header(' location: index.php '); } else { echo "Incorrect password."; } } else { echo "That email does not exist."; } } else { echo "Please fill in <strong>all</strong> fields."; } } ?> <p> <html> <form action = 'login.php' method = 'POST'> Email: <input type = 'text' name = 'email'> <p> Password: <input type = 'text' name = 'password'> <p> <input type = 'submit' name = 'login' value = 'Login'> </form> </html> Global.php: <?php // This is the global file for the entire website // Start a session session_start(); // Start MySQL connection mysql_connect('localhost', 'root', 'root'); ?> Any ideas? the page below worked until i added the php include part to the top of the page and now i get the header error message for some of my web pages but i have fixed them all but this one. How do i fix this because i can't move them to the top of the page just under the php include like i needed to do with the other pages because if i move them up it will put the forms at the top aswell. <?php include("protect page file location"); ?> <!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=utf-8" /> <title>Dvds</title> <link href="../../style.css" rel="stylesheet" type="text/css" /> </head> <link href="uploadify/uploadify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="uploadify/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="uploadify/swfobject.js"></script> <script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#file_upload').uploadify({ 'uploader' : 'uploadify/uploadify.swf', 'script' : 'uploadify/uploadify.php', 'cancelImg' : 'uploadify/cancel.png', 'folder' : '../../dvds/dvd_files', 'displayData' : 'percentage', 'auto' : true, 'multi' : true }); }); </script> <body> <div class="container"> <div class="header"><br /><br /><br /> </div> <div class="sidebar1"> <ul class="nav"><b> <li><a href="../../">Home</a></li> <li><a href="../">Testimonials upload</a></li> <li><a href="../audio/">Audio Testimonials upload</a></li> <li><a href="../dvds/">Dvd's upload</a></li> <li><a href="../newsletter/">Newsletter upload</a></li> <li><a href="../news/">News box update</a></li> <li><a href="http://www.weblink.co.cc/admin/?logout=1">Logout</a></li> </b></ul></div> <div class="content"><div class="text"> <center><h3>Admin</h3> <br /> <p><input id="file_upload" name="file_upload" type="file" /></p></center> <center><p><form method="get" action="index.php"> <select name="id" class="inputstandard"> <option value="default">Select Dvd</option><?php include("dbinfo1.inc.php"); mysql_connect($localhost,$username,$password); mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query('SELECT * FROM Dvd ORDER BY id ASC') or die (mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo '<option value="' . $row['id'] . '" name="' . $row['id']. '">Dvd ' . $row['id']. '</option>'; } ?> </select> <input type="submit" value="Submit"> </form></p> <p><?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $file = $_GET["id"]; $result=mysql_query("SELECT * FROM Dvd where id='$file'") or die("ERROR:".mysql_error()); $row=mysql_fetch_array($result,MYSQL_ASSOC); print '<form method="POST" action="insert_dvd.php">'; print '<table border="0">'; print '<tr>'; print '<td><input type="hidden" name="id" value="'.$file.'"></td>'; print '</tr>'; print '<tr>'; print '<td align="right">Dvd Name:</td>'; print '<td><input type="text" name="Watch" value="'.$row['Watch'].'" /></td>'; print '</tr>'; print '<td colspan="2" align="center"><input type="submit" name="submit" value="Update"></td>'; print '</tr>'; print '</table>'; print '</form>'; mysql_close($link); ?><br /><?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $file = $_GET["id"]; $result=mysql_query("SELECT * FROM Dvd where id='$file'") or die("ERROR:".mysql_error()); $row=mysql_fetch_array($result,MYSQL_ASSOC); print '<form method="GET" action="delete.php">'; print '<table border="0">'; print '<tr>'; print '<td><input type="hidden" name="id" value="'.$file.'"></td>'; print '</tr>'; print '<tr>'; print '<td align="right">Dvd Name:</td>'; print '<td><input type="text" name="Watch" value="'.$row['Watch'].'.wmv" /></td>'; print '</tr>'; print '<td colspan="2" align="center"><input type="submit" name="submit" value="Delete"></td>'; print '</tr>'; print '</table>'; print '</form>'; mysql_close($link); ?> </p></center></div> </div> <div class="sidebar2"> <center><h4>Help</h4></center> <p>text here</p> </div> <div class="footer"> <center><p>&#169; Copyright 2010</p></center> </div> </div> </body> </html> the below are the php parts causing the problems. <?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $file = $_GET["id"]; $result=mysql_query("SELECT * FROM Dvd where id='$file'") or die("ERROR:".mysql_error()); $row=mysql_fetch_array($result,MYSQL_ASSOC); print '<form method="POST" action="insert_dvd.php">'; print '<table border="0">'; print '<tr>'; print '<td><input type="hidden" name="id" value="'.$file.'"></td>'; print '</tr>'; print '<tr>'; print '<td align="right">Dvd Name:</td>'; print '<td><input type="text" name="Watch" value="'.$row['Watch'].'" /></td>'; print '</tr>'; print '<td colspan="2" align="center"><input type="submit" name="submit" value="Update"></td>'; print '</tr>'; print '</table>'; print '</form>'; mysql_close($link); ?> <br /> <?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $file = $_GET["id"]; $result=mysql_query("SELECT * FROM Dvd where id='$file'") or die("ERROR:".mysql_error()); $row=mysql_fetch_array($result,MYSQL_ASSOC); print '<form method="GET" action="delete.php">'; print '<table border="0">'; print '<tr>'; print '<td><input type="hidden" name="id" value="'.$file.'"></td>'; print '</tr>'; print '<tr>'; print '<td align="right">Dvd Name:</td>'; print '<td><input type="text" name="Watch" value="'.$row['Watch'].'.wmv" /></td>'; print '</tr>'; print '<td colspan="2" align="center"><input type="submit" name="submit" value="Delete"></td>'; print '</tr>'; print '</table>'; print '</form>'; mysql_close($link); ?> |