PHP - How Can Php Undefined Index A Freaking Row Value?
are you freaking kidding me or am i just gone dead?
Code: [Select] if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ $subforums = " {$info['subforums1']} {$info['subforums']}"; } I fixed the $cookie['subforum'] and added the isset, but now it's saying my subforums1 and subforums are UNDEFINED? Is this a joke? it's not a INPUT it's simply a variable from my DATABASE .... being called? this is my hole heredoc Code: [Select] return <<<EOF <tr $color> <td style=border-left:none><b><span class="forumhover"><a href="{$ibforums->base_url}z={$info['id']}" title='{$info['description']}'>{$info['name']}</a></span> </b> <span class='desc'> $subforums <br></span>$moderator</span></td> <td align='center' nowrap><span class=desc4>Posts:</span> {$info['posts']}<br> <span class=desc4>Topics:</span> {$info['topics']} </td> <td> » <b>{$info['last_topic']}</b></span> <br><span class="forumhover3">{$ibforums->lang['by']} {$info['last_poster']} <span class="desc4">{$info['last_post']}</span> </span> </td> </tr> EOF; ONLY the SUBFORUMS are being UNDEFINED the other $info's like post's,last_posters,last_post ARE NOT Showing errors but the subforums one are? this is literally making me tear my hair out, this is outrageous! any idea why it would do this? pissing me off, I never had to isset those other $info's and it's not calling them as undefined error's but hell whenever I try to code my own mods/etc it always doesn't work the way I want, pathetic, i hate myself and I hate this isset STUFF, does it even effect performance that much? this is just getting ridiclious Similar TutorialsI really dont no what the problem is and im new here so i dont no if this is the right place to put this but im trying to make a registration page for my server and when i bring it up it says Undefined index: action in C:\xampp\htdocs\index.php on line 56 and idk what to do >.< this is the line that has the problem if($_POST['action']!="signup") so hopefully u guys could help me :/ Im using xampp btw Hello, I have just upgraded my wampserver and with it MySQL, PHP and PhpMyAdmin versions. And my scripts, which ran normally before, not burst hundreds of undefined variable and undefined index notices. I realize it's "notices", not "errors" but this is quite irritating. I believe it might be due to some upgrade in PHP scripting rules or something but I don't know what. I hope you can help me. The first type of notice is "undefined variable". This function will return the notice if I remove the bold red line, where I define the variable as empty before I use it in the loop. I didn't need to do this before. function statistics($array) { [color=red][b]$list = '';[/b][/color] if(is_array($array)) { foreach($array as $name => $value) { // Rip out the name of the client. $list .= "<li>".$name." - "; // set an integer so we know how many tier2 values we have read. $x = 0; foreach($value as $difference => $sum_total) { // if this is the more than the first tier2 values, use a '+' between the units. $list .= (++$x > 1) ? " + ".$sum_total." ".$difference : $sum_total." ".$difference; } // close the line out. $list .= "</li>"; } } return $list; } To avoid the 10+ like notices on the page I declare them empty before the variable's first occurrence. But this sounds stupid to me. Wasn't this one of PHP's benefits, not to have to declare the variable before using it? I also get about 30+ undefined index notices, e.g. Quote Notice: Undefined index: COMPANY XXX in F:\wamp\www\Project Management\main.php on line 37 Notice: Undefined index: USD in F:\wamp\www\Project Management\main.php on line 37 Notice: Undefined index: USD in F:\wamp\www\Project Management\main.php on line 41 Here are those lines: $income_total = calculate("income"); foreach($income_total as $row) { $clientID = $row['clientID']; $clientname = $row['clientname']; //$client = "<a href=\"index.php?page=Client&do=view&clientID=$clientID\">".$clientname."</a>"; $client = "<a href=\"index.php?page=Project&do=view&sortby=$clientID\">".$clientname."</a>"; $currency = $row['currency']; $client_sum = $row['client_sum']; $year_sum = ''; $year_sum += $client_sum; $income = ''; $income[$client][$currency] += $client_sum; $income_list = statistics($income); $income_all = ''; $income_all[$currency] += $client_sum; } Line 37 is: Quote $income[$client][$currency] = It's the values assigned to $client and to $currency that seem to cause the notice. How do I deal with this? I don't just want to turn error/notice display off, I want to resolve this issue. please help! I am getting undefined index and offset when I duplicated my SEARCH page for when logged in here is my code Code: [Select] <?php include_once("config.php"); include_once("functions.php"); // Check user logged in already: checkLoggedIn("yes"); ?> <!doctype html> <html> <head> <title>Retro and Vintage</title> <meta name="description" content="xxx" /> <meta name="keywords" content="xxx" /> <meta name="Content-Language" content="en-gb" /> <meta name="robots" content="FOLLOW,INDEX" /> <meta name="revisit-after" content="2 days" /> <meta name="copyright" content="jbiddulph.com" /> <meta name="author" content="John Biddulph - Professional web site design and development in the south of england mainly worthing and brighton" /> <meta name="distribution" content="Global" /> <meta name="resource-type" content="document" /> <link rel="stylesheet" type="text/css" href="css/reset.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" title="default" /> <link rel="alternate stylesheet" type="text/css" href="css/style1.css" title="1" /> <link rel="alternate stylesheet" type="text/css" href="css/style2.css" title="2" /> <script type="text/javascript" src="js/stylechanger.js"></script> <script type="text/javascript" src="js/jquery-1.2.1.pack.js"></script> <script type="text/javascript"> function lookup(inputString) { if(inputString.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else { $.post("rpc.php", {queryString: ""+inputString+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } // lookup function fill(thisValue) { $('#inputString').val(thisValue); setTimeout("$('#suggestions').hide();", 200); } </script> </head> <body> <?php if($messages) { displayErrors($messages); }?> <header> <div id="title"> <h1>My Pub Space <a href="#" onClick="setActiveStyleSheet('default'); return false;"><img src="images/0.gif" width="15" height="15" border="0" alt="css style" /></a> <a href="#" onClick="setActiveStyleSheet('1'); return false;"><img src="images/1.gif" width="15" height="15" border="0" alt="css style" /></a> <a href="#" onClick="setActiveStyleSheet('2'); return false;"><img src="images/2.gif" width="15" height="15" border="0" alt="css style" /></a> <span> <form method="post" class="textbox" action="search1.php"> City/Town: <input type="text" size="26" class="searchbox" value="" id="inputString" onKeyUp="lookup(this.value);" onBlur="fill();" /> <div class="suggestionsBox" id="suggestions" style="display: none;"> <img src="images/upArrow.png" style="position: relative; top: -36px; left: 105px; z-index:1;" alt="upArrow" /> <div class="suggestionList" id="autoSuggestionsList"> </div> </div> <input type="image" src="images/go.png" height="30" with="30" value="GO" /> </form> </span> </h1> </div> </header> <nav> <ul> <li class="selected"><a href="#">Home</a></li> <li><a href="#">Pubs</a></li> <li><a href="#">Members</a></li> <li><a href="#">Events</a></li> <li><a href="#">Register</a></li> </ul> </nav> <section id="intro"> <header> <h2>Your social guide to going down the pub, online!</h2> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.</p> <img src="images/pub.jpg" alt="pub" /> </section> <div id="content"> <div id="mainContent"> <section> <article class="blogPost"> <header> <h2>This is the title of a blog post</h2> <p>Posted on <time datetime="2009-06-29T23:31+01:00">June 29th 2009</time> by <a href="#">Mads Kjaer</a> - <a href="#comments">3 comments</a></p> </header> <?php // drop out of PHP mode to display the plain HTML: $Townsearch = $_GET['rsTown']; echo $Townsearch; // Delimiters may be slash, dot, or hyphen list($Town, $County) = split('[,]', $Townsearch); $tableName="pubs"; $targetpage = "search1.php"; $limit = 20; $query = "SELECT COUNT(*) as num FROM $tableName WHERE rsTown LIKE '$Town%'"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages['num']; $stages = 3; $page = mysql_escape_string($_REQUEST['page']); if( isset($_REQUEST['page']) && ctype_digit($_REQUEST['page']) ) { $page = (int) $_GET['page']; $start = ($page - 1) * $limit; }else{ $start = 0; } // Get page data $query1 = "SELECT * FROM $tableName WHERE rsTown LIKE '$Town%' LIMIT $start, $limit"; $result = mysql_query($query1); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; $paginate = ''; if($lastpage > 1) { $paginate .= "<div class='paginate'>"; // Previous if ($page > 1){ $paginate.= "<a href='$targetpage?page=$prev'>previous</a>"; }else{ $paginate.= "<span class='disabled'>previous</span>"; } // Pages if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few? { // Beginning only hide later pages if($page < 1 + ($stages * 2)) { for ($counter = 1; $counter < 4 + ($stages * 2); $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // Middle hide some front and some back elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2)) { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $page - $stages; $counter <= $page + $stages; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // End only hide early pages else { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } } // Next if ($page < $counter - 1){ $paginate.= "<a href='$targetpage?page=$next'>next</a>"; }else{ $paginate.= "<span class='disabled'>next</span>"; } $paginate.= "</div>"; } echo $total_pages.' Results'; // pagination echo $paginate; ?> <ul> <?php while($row = mysql_fetch_array($result)) { echo '<li>'.$row['rsPubName'].', '.$row['rsTown'].', '.$row['rsCounty'].'</li>'; if ($_SESSION["rsUser"] == "admin") { echo "<a href=\"edit.php?PUBID=".$row['PubID']."\" class=\"small\">edit this pub</a>"; } } ?> </ul> </article> </section> <section id="comments"> <h3>Comments</h3> <article> <header> <a href="#">George Washington</a> on <time datetime="2009-06-29T23:35:20+01:00">June 29th 2009 at 23:35</time> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.</p> </article> <article> <header> <a href="#">Benjamin Franklin</a> on <time datetime="2009-06-29T23:40:09+01:00">June 29th 2009 at 23:40</time> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.</p> </article> <article> <header> <a href="#">Barack Obama</a> on <time datetime="2009-06-29T23:59:00+01:00">June 29th 2009 at 23:59</time> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.</p> </article> </section> <form action="#" method="POST" method="post"> <h3>Post a comment</h3> <p> <label for="name">Name</label> <input name="name" id="name" type="text" required /> </p> <p> <label for="email">E-mail</label> <input name="email" id="email" type="email" required /> </p> <p> <label for="website">Website</label> <input name="website" id="website" type="url" /> </p> <p> <label for="comment">Comment</label> <textarea name="comment" id="comment" required></textarea> </p> <p> <input type="submit" value="Post comment" /> </p> </form> </div> <aside> <section> <header> <h3>Members Login Area</h3> </header> <h4>Welcome <? print($_SESSION["rsUser"]); ?></h4> <a href="logout.php">Logout</a> </section> <section> <header> <h3>Archives</h3> </header> <ul> <li><a href="#">December 2008</a></li> <li><a href="#">January 2009</a></li> <li><a href="#">February 2009</a></li> <li><a href="#">March 2009</a></li> <li><a href="#">April 2009</a></li> <li><a href="#">May 2009</a></li> <li><a href="#">June 2009</a></li> </ul> </section> </aside> </div> <footer> <div> <section id="about"> <header> <h3>About</h3> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco <a href="#">laboris nisi ut aliquip</a> ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </section> <section id="blogroll"> <header> <h3>Blogroll</h3> </header> <ul> <li><a href="#">NETTUTS+</a></li> <li><a href="#">FreelanceSwitch</a></li> <li><a href="#">In The Woods</a></li> <li><a href="#">Netsetter</a></li> <li><a href="#">PSDTUTS+</a></li> </ul> </section> <section id="popular"> <header> <h3>Popular</h3> </header> <ul> <li><a href="#">This is the title of a blog post</a></li> <li><a href="#">Lorem ipsum dolor sit amet</a></li> <li><a href="#">Consectetur adipisicing elit, sed do eiusmod</a></li> <li><a href="#">Duis aute irure dolor</a></li> <li><a href="#">Excepteur sint occaecat cupidatat</a></li> <li><a href="#">Reprehenderit in voluptate velit</a></li> <li><a href="#">Officia deserunt mollit anim id est laborum</a></li> <li><a href="#">Lorem ipsum dolor sit amet</a></li> </ul> </section> </div> </footer> </body> </html> error lies on these lines Code: [Select] // drop out of PHP mode to display the plain HTML: $Townsearch = $_GET['rsTown']; echo $Townsearch; // Delimiters may be slash, dot, or hyphen list($Town, $County) = split('[,]', $Townsearch); my current code: Code: [Select] $Townsearch = $_REQUEST['rsTown']; list($Town, $County) = split('[,]', $Townsearch); ltrim($County,1); I am getting undefined index and undefined offset, so I tried this: Code: [Select] if $_REQUEST['rsTown'] == ''{ $Townsearch = ''; } else { $Townsearch = $_REQUEST['rsTown']; } but this brought back: Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in D:\retroandvintage.co.uk\wwwroot\main.php on line 6 Can someone please help? thanks hi, I need help really badly for my PHP-Postcard Script. Basically it sends the card out but the URL does not work, I get the following error message: The URL is not valid and cannot be loaded It also states that Notice: Undefined index: www.voluntary.awardspace.co.uk in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 Notice: Undefined index: Postcard.php in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 See Code below: <?php session_start(); //check error log ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); // CHANGE PARAMETERS HERE BEGIN $senderName = " Holidays From Home "; // Eg.: John's Postcards $senderEmail = "chris01@voluntary.awardspace.co.uk"; // Eg.: john@postcard.com // Change only if you have problems with urls $postcardURL = "http://".$_SERVER["www.voluntary.awardspace.co.uk"].$_SERVER["Postcard.php"]; // CHANGE PARAMETERS HERE END $result = 0; $msg = ""; $msg1 = ""; $pic = ""; function displayPhotos() { global $pic; $columns = 5; $act = 0; $act1 = 0; // Open the actual directory if($handle = opendir("thumbs")) { // Read all file from the actual directory while($file = readdir($handle)) { if(!is_dir($file)) { if(isset($pic[1])) { if($pic[1] == $act1){$sel = "checked";} else{$sel = "unchecked";} } if($act == 0){echo "<tr>";} echo "<td align='center'><img src='thumbs/$file' alt='postcard'/><br/><input type='radio' name='selimg' value='$file,$act1' $sel/></td>"; $act++; $act1++; if($act == $columns){$act = 0;echo "</tr>";} } } echo "</tr>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Postcard</title> <link href= "style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div class="style1" id="caption"> <div align="left" class="style1"></div> </div> <?php //makes sure form is correctly filled in if(!empty($_POST["submit"])) { if(empty($_POST["selimg"])){$msg = "Please select an image from above!";$result = 3;} else{$pic = explode(",",$_POST["selimg"]);} if(empty($_POST["email"]) && empty($result)){$msg1 = "You must enter an email address!";$result = 3;} $secCode = empty($_POST["secCode"]) ? "" : strtolower($_POST["secCode"]); if($secCode == $_SESSION["securityCode"] && $result != 3) { $filename = date("YmdGis"); $f = fopen("messages/".$filename.".txt","w+"); fwrite($f,$pic[0]."\n"); fwrite($f,$_POST['email']."\n"); fwrite($f,stripslashes($_POST["message"])."\n"); fclose($f); // Compose the mail $from = "From: $senderName <$senderEmail>\r\n"; $replay = "Reply-To: $senderEmail\r\n"; $params = "MIME-Version: 1.0\r\n"; $params .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailtext = "You have just received a Virtual Postcard!\r\n\r\n You can pick up your postcard at the following web address:\r\n $postcardURL?show=$filename\r\n\r\n We hope you enjoy your postcard, and if you do, please take a moment to send a few yourself!\r\n\r\n Regards,\r\n Holidays From Home\r\n $postcardURL"; // Send email @mail($_POST["email"],"You've received a postcard",$mailtext,$from.$replay.$params); echo "<center> Your postcard was sent successfully!<br /><br /> <img src='images/$pic[0]' alt='postcard' /><br /><br /><br />".stripslashes($_POST["message"]). "</center>"; $result = 1; } else{if($result != 3){$result = 2;}} } if(!empty($_GET["show"])) { $file = $_GET["show"]; $content = file("messages/$file.txt"); $pic = $content[0]; unset($content[0]); unset($content[1]); foreach($content as $value){$main .= $value;} echo "<center> Your postcard!<br /><br /> <img src='images/$pic' alt='postcard' /><br /><br /><br />$main </center>"; } if((empty($result) || $result == 2 || $result == 3) && empty($_GET["show"])) { echo "<form action='#' method='post'> <table align='center'>"; displayPhotos(); echo "</table> <div style='color:#f00;font-size:16px;'>$msg</div> <h2>Fill in the Form and then click on Send Card!!</h2> <table width='100%'> <tr><td>Send to (email address):</td><td><div style='color:#f00;font-size:16px;'>$msg1</div><input type='text' name='email' size='30' value='".$_POST["email"]."' /></td></tr> <tr><td>Message:</td><td><textarea name='message' rows='10' cols='40'>".stripslashes($_POST["message"])."</textarea></td></tr> <tr><td colspan='2'>".($result == 2 ? "<p style='color:#f00;font-size:16px;'>Sorry the security code is invalid! Please try it again!</span></p>" : " ")."</tr> <tr> <td>Security code: <input class='text' name='secCode' type='text' size='10' /> </td><td><img src='securityCode.php' alt='security code' border='1' /></td> </tr> <tr><td colspan='2'> </tr> <tr><td colspan='2' align='left'><input type='submit' value='Send card!' name='submit'/></td></tr> </table> </form>"; } ?> Absolutely any help would be much appreciated. I want ot know is there a way round this problem? Here is the http://voluntary.awardspace.co.uk/Postcard.php I am absolutely desperate to solve this burning issue Please explain the philosophy here..
if this is ok and generates no errors or Notices
$result = mysqli_query($connection, $query); if (!$result) { die("Database Query Failed: " . mysql_error()); } else { } while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>Address</td>"; echo "<td>"; echo $row['streetaddress']; echo "</td></tr>"; }Why does this code which is seemingly the same - aside from the logic test - generate an Undefined Index Notice? if (!empty($row['child1name'])) { echo "<tr>"; echo "<td colspan=\"2\">"; echo $row['child1name'] . " (" . $row['child1age'] . ")"; }and is the correct answer to decalre all of these variables in advance? thanks. im having problems with the initial loading of a page "Undefined index". i no the problem is due to 2 $vars having no value but i dont no how to get around the problem. its a form that posts to itself then pulls from the database. once you hit submit the problem goes away. i just need to sort the 1st page load out thanks the problem is the 1st 2 lines of the snippet. snippet $ser_type=$_POST['list']; $search = $_POST['search']; if ($search == '' || $search == ' '){ echo "Search Field is Empty - Please Input a Search Query!"; die; } else{ if ($ser_type=="sku"){ $sql = "SELECT * from $tbl_name WHERE sku like '%$search%' or rsku like '%$search%'"; $result = mysql_query($sql); full code <?php include("http://localhost/dsgi/includes/header.html"); ?> <!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>Modify DataBase</title> </head> <body> <form method="post" action="main.php"> <table class="tablesrch" width=583 height="101" border="0" align=center> <tr> <td height="32" colspan="2"> <div align="center">Enter Search: <input type=text name='search' size=20 maxlength=255> </div></td> </tr> <tr> <td width="193" align="right">Search By:</td> <td width="380"><label> <input name="list" type="radio" id="SKU" value="sku" checked> SKU <input name="list" type="radio" id="make" value="make"> Make <input type="radio" name="list" id="model" value="model"> Model</label></td> </tr> <td height="28" colspan="2"><div align="center"><input type=submit></div></td></tr> </table> </form> <p align="center"> </p> <table class="table2" align="center"> <tr> <td align="center"> <?php //include("http://localhost/dsgi/includes/config.php"); $INC_DIR = $_SERVER["DOCUMENT_ROOT"]. "/dsgi/includes/"; include($INC_DIR. "config.php"); // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $tbl_name="dsgi_serval"; // Retrieve data from database $ser_type=$_POST['list']; $search = $_POST['search']; if ($search == '' || $search == ' '){ echo "Search Field is Empty - Please Input a Search Query!"; die; } else{ if ($ser_type=="sku"){ $sql = "SELECT * from $tbl_name WHERE sku like '%$search%' or rsku like '%$search%'"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { echo "Image is on the server. If not green please inform imaging team"; ?> </td> </tr> </table> <table class="table1" width="800" height="72" align="center"> <tr class="tablehead"> <th width="113" align="center">Recon SKU</th> <th width="66" align="center">Orig SKU</th> <th width="90" align="center">Make</th> <th width="169" align="center">Model</th> <th width="58" align="center">Recovery</th> </span></span></tr> <?php while ($rows=mysql_fetch_array($result)){ // table bg colour $choice = strtoupper($rows['comments']); $findme = 'FAIL'; $findme1 = 'PASS'; $mystring2 = trim($rows['comments']); $pos2 = stripos($mystring2, $findme); $pos1 = stripos($mystring2, $findme1); if ($pos1 !== false){ $bgc = "pass" ; } elseif ($pos2 !== false){ $bgc = "fail" ; }else{ $bgc = "wait" ; } ?> <tr id="tabledata" class="<?php echo "$bgc"; ?>"> <td> <?php echo $rows['sku'] ; ?></td> <td> <?php echo $rows['rsku']; ?></td> <td> <?php echo $rows['make']; ?></td> <td> <?php echo $rows['model']; ?></td> <td> <?php echo $rows['recovery']; ?></td> </tr> <?php } } else { $sql = "SELECT * from dsgi_request WHERE sku = '$search'"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { while ($rows=mysql_fetch_array($result)){ ?> Image not found on server. <br> please Inform Engineering Team. <?php } ?> <?php }else{ ?> Image not found on server.<br> please Inform Engineering Team. </table> <table width="350" border="1" align="center" cellpadding="0" cellspacing="1"> <tr> <td><form name="form1" method="post" action="request_ac.php"> <table width="100%" border="1" cellspacing="1" cellpadding="3"> <tr> <th colspan="3" > Image Request </th> </tr> <tr> <td>SKU</td> <td>:</td> <td><input name="sku" type="text" id="sku" size="30" maxlength="6" /></td> </tr> <tr> <td width="97">Make</td> <td width="3">:</td> <td width="222"><input name="make" type="text" id="make" size="30"></td> </tr> <tr> <td>Model</td> <td>:</td> <td><input name="model" type="text" id="model" size="30"></td> </tr> <tr> <td>OS</td> <td>:</td> <td><input name="os" type="text" id="os" value="Which Version? Home, Basic?" size="30" /></td> </tr> <tr> <td>Serial</td> <td>:</td> <td><input name="serial" type="text" id="serial" size="30" /></td> </tr> <tr> <td>Bcn</td> <td>:</td> <td><input name="bcn" type="text" id="bcn" size="30" /></td> </tr> <tr> <td>Cell</td> <td>:</td> <td><label> <select name="personel" id="personel"> <option selected="selected">Laptop Cell</option> <option>Cell A</option> <option>Cell B</option> <option>Cell C</option> <option>Desk Top's</option> </select> </label></td> </tr> <tr> <td>Date</td> <td>:</td> <td><input name="date" type="text" id="date" value="<?php echo date("d, M, Y - h:i:s"); ?>" size="30" readonly="readonly" /></td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </td> </tr> </table> <?Php } } } else{ $sql = "SELECT * from $tbl_name WHERE $ser_type like '%$search%'"; $result = mysql_query($sql); $srch = strtoupper($search); $sertype = strtoupper($ser_type); // echo "$sertype Search Result's For $srch"; echo "Searched $sertype For $srch"; ?> </td> </tr> </table> <table class="table1" width="800" height="72" align="center"> <tr class="tablehead"> <td>Recon SKU</td> <td>Orig SKU</td> <td>Make</td> <td>Model</td> <td>Recovery</td> </tr> <?php while ($rows=mysql_fetch_array($result)){ // table bg colour $choice = strtoupper($rows['comments']); $findme = 'FAIL'; $findme1 = 'PASS'; $mystring2 = trim($rows['comments']); $pos2 = stripos($mystring2, $findme); $pos1 = stripos($mystring2, $findme1); if ($pos1 !== false){ $bgc = "pass" ; } elseif ($pos2 !== false){ $bgc = "fail" ; }else{ $bgc = "wait" ; } // $bgc = "#EE2C2C" ;red // $bgc = "#FF6600" ; amber ?> <?php $make = strtoupper($rows['make']); ?> <tr id="tabledata" class="<?php echo "$bgc"; ?>"> <td> <?php echo $rows['sku'] ; ?></td> <td> <?php echo $rows['rsku']; ?></td> <td> <?php echo $make; ?></td> <td> <?php echo $rows['model']; ?></td> <td> <?php echo $rows['recovery']; ?></td> </tr> <?php } } } ?> <p> </p> </body> </html> I've tried multiple mysql tutorials thus far and some of them, have codes like this: $Page = $_GET["BLAH"]; if(!$_GET["BLAH"]) , I get an error of "Notice: Undefined Index: BLAH" in the file location and line number. Does anybody know what undefined index means and how I can patch up the problem? Thanks! I've gotten different "Notices" for "Undefined Index." For different $_POST['vars'], I've corrected with adding an isset() at the top of my if condition. I'm stumped now for how to approach my current notice. Am tempted to just block errors on my server, but don't believe that is really fixing it. I've added a multiple select array to my form. I pass it correctly and access it fine. Only thing, for checking with error checking, if it is blank, the form will repopulate. If checked, the data passes correctly. If there are no selections, then I get the Undefined Index error from PHP. I wrote a routine to check if it is null, but that doesn't seem to do it. I want to check that it is not null, and if it is, then repost the form. If I put in isset(), it would never go past. If I don't put isset(), then it will cry with the error. Any Thoughts? Hi, I have an undefined index problem and not sure how to fix it. I dont want to turn off errors - I would like to learn how to actually fix this problem. It happens in line 13 which is marked below with //line 13 comment. The exact error is: Notice: Undefined index: synonymsearch in C:\wamp\www\ezsynonym\index.php on line 13 TIA. Code: [Select] <?php //start buffering output ob_start(); include("db.php"); $mysqli = new mysqli($dbServer, $dbUser, $dbPass, $dbName); //report any errors on screen for debugging //echo "connection errors: " . mysql_error() . "<BR>"; //STORE THE USER INPUT IN VARIABLES $strErrorResults = ""; $strWordResults = ""; //line 13 - this is where the error happens. $queryWord = $_REQUEST['synonymsearch']; if ($queryWord == "" || $queryWord == "Search Synonym") { $strWordResults = "Enter a word to search for"; } else { //search for target word in wordlist $result = $mysqli->query("select * from wordlist where word='{$queryWord}'"); if ($result->num_rows > 0) { //extract the target word's primary key $word_arr = $result->fetch_array(MYSQLI_ASSOC); $word_id = $word_arr['pri']; //search for target word's primary key in the links table's wordid column $synonymQuery = "select * from links where wordid='{$word_id}'"; $synonymResult = $mysqli->query($synonymQuery); $arrKeys = array(); //create an array if ($synonymResult->num_rows > 0) { //grab the corresponding synonym ids and store into the array while ($row = $synonymResult->fetch_array(MYSQLI_ASSOC)) { $arrKeys[] = $row['synid']; } } foreach ($arrKeys as $value) { $sQuery = "select * from wordlist where pri='{$value}'"; $result = $mysqli->query($sQuery); $result_arr = $result->fetch_array(MYSQLI_ASSOC); // echo $result_arr['word']; $strWordResults .= <<<END <div id="results-left"><a href="index.php?synonymsearch={$result_arr['word']}"> {$result_arr['word']} </a></div><br/><br/> END; } // end for } // end if else { //word does not exist in the database $strErrorResults .= <<<END <p>failure... word does not exist in the system</p> END; } } print <<<END <!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" /> <link rel="stylesheet" href="style.css" type="text/css" media="screen"> <link rel="icon" href="favicon.ico" type="image/x-icon"> <title>ezSyonym</title> </head> <body> <div id="header"> <a href="index.php"><img src="images/logo-final.gif"></a> </div> <div id="content"> <div id="left-col"> <div id="searchbox"> <form id="searchform" method="post" action="index.php"> <input id="input" name="synonymsearch" type="text" value="Search Synonym" maxlength="400px" /> </form> </div> <div id="search-results"> {$strErrorResults} {$strWordResults} </div> </div> <div id="right-col"> <div id="sidebar"> </div> </div> </div> <div id="footer"></div> </body> </html> END; //send data to the browser ob_end_flush(); ?> Hi there i keep getting an error: Notice: Undefined index: ShipYard in C:\wamp\www\SWB2\test3.php on line 160 Heres the relevant select query: Code: [Select] // COUNT SHIPYARDS $colname_shipyard = 'Empire'; mysql_select_db($database_swb, $swb); $query_shipyard = sprintf("SELECT SUM(ShipYard) FROM planet WHERE PlayerName = %s", GetSQLValueString($colname_shipyard, "text")); $shipyard = mysql_query($query_shipyard, $swb) or die(mysql_error()); $row_shipyard = mysql_fetch_assoc($shipyard); $totalRows_shipyard = mysql_num_rows($shipyard); The error is pointing to: Code: [Select] echo $row_shipyard['ShipYard'];Im a bit of a noob and have tried changing to: Code: [Select] echo $row['ShipYard']; When i do this i get a different error: Notice: Undefined variable: row in C:\wamp\www\SWB2\test3.php on line 159 The row ShipYard is in a table called planet but its not suppose to be indexed or unique. Am I missing something here?? Thanks Hi ive been having an issue with this for a long time and i never found a fix from pure google so i have come to ask other human beings heres my code: Code: [Select] <a href="index.php?page=news">News</a> <?php define ('page', 'page'); switch($_GET[page]) { case "news": include "news.php"; break; case "is-it-for-me": include "for_me.php"; break; } ?> This is what shows up when first entering index.php Quote Notice: Undefined index: page in C:\xampp\htdocs\template1\index.php on line 35 Thanks in advance, Sycohazza hi guys, I have a form which allows me to update my database with the inputted values, the form works and it updates my database, however I have these error messages all over my webpage Notice: Undefined index: title in C:\xampp\htdocs\CS2410\add_dvd.php on line 12 Notice: Undefined index: category in C:\xampp\htdocs\CS2410\add_dvd.php on line 13 Notice: Undefined index: quantity in C:\xampp\htdocs\CS2410\add_dvd.php on line 14 Notice: Undefined index: price in C:\xampp\htdocs\CS2410\add_dvd.php on line 15 Notice: Undefined index: bar_code in C:\xampp\htdocs\CS2410\add_dvd.php on line 16 the code is below Code: [Select] <?php session_start(); // a security measure, if unautherised users attempt to directly access the page they are redirected to the index page if (!($_SESSION['autherised']== true)) { header("Location:index.php"); } //make a connection to the server or terminate the script if a connection cannot be estabilshed $svc = @mysql_connect("localhost","root") or die ('unable to connect to server'.' '.mysql_error()); //make a connection to the databaes or terminate the script if a connection cannot be estabilshed $dbc = @mysql_select_db("aston_shopdb",$svc) or die ('unable to connect to database'.' '.mysql_error()); $nameofdvd = $_POST['title']; $categoryofdvd = $_POST['category']; $quantity = $_POST['quantity']; $dvdprice = $_POST['price']; $bar_id = $_POST['bar_code']; $sql = "INSERT INTO item SET Title='$nameofdvd', Category='$categoryofdvd', Quantity='$quantity', Price='$dvdprice', Bar_code='$bar_id'"; if (@mysql_query($sql)) { echo('<p>New DVD added</p>'); } else { echo('<p>Error adding new dvd: ' . mysql_error() . '</p>'); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="aston-shop-scheme.css" /> <title>Add a New DVD</title> </head> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <p>Enter the new DVD:<br /> Title: <input type="text" name="title" size="20" maxlength="255" /><br /> Category: <input type="text" name="category" size="20" maxlength="255" /><br /> Quantity: <input type="text" name="quantity" size="20" maxlength="255" /><br /> Price: <input type="text" name="price" size="20" maxlength="255" /><br /> Barcode: <input type="text" name="bar_code" size="20" maxlength="255" /><br /> <input type="submit" name="submit" value="SUBMIT" /></p> </form> <table class ="standard" > <tr> <td> <input type ="button" class="input" onClick ="location.href='all_products.php'" value ="View all products"> </td> </tr> <tr> <td> <input type ="button" onclick ="location.href='Logout.php'" value ="Log out"> <td> </tr> </table> </body> </html> please help!!! nick MOD EDIT: code tags added. i am trying to sort out some errors i have on my website but am not really all that clued up with PHP or MySql...... currently on this page http://fifaworld360.co.uk/headtohead/team.php i am thrown 3 errors...... now it says the errors are on line 11, 12 & 13 which would be this part of the code ....... Code: [Select] $league = $_REQUEST["league"]; $league_id = get_league_id($league); $team = rawurldecode($_REQUEST["team"]); below is the full code for this page..... what i need is for someone to tell me if their is something wrong...i got a funny feeling it is something silly but as i said i am not clued up on this at all....the site was built for me and has since been throwing errors when the coder left..... now i just need to sort it so i can re run it again.. Code: [Select] if (!isset($_REQUEST["team"])){ $league = $random_league; $league_id = get_league_id($league); $team = random_team($league_id); }else{ $league = $_REQUEST["league"]; $league_id = get_league_id($league); $team = rawurldecode($_REQUEST["team"]); } //echo "<br>team: $team"; $team_information = get_team_information_by_name($team); $team_id = get_team_id($team_information[1]); $user_id = get_current_user_id($team_id, $league_id); $user_name = get_user_name($user_id); ?> <div class="DivMiddleLeagueTable"> <table class="layoutTable" width="100%" cellspacing="0" border="0"> <tbody> <tr> <td> <table class="layoutTable" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td class="layout" valign="top"> <div class="layout"> <div id="leagueTable" class="TeamTable"> <table class="TeamTable" width="100%" cellspacing="0" border="0"> <tbody> <tr class="header"> <td colspan="4">Team: <?php echo $team_information[1];?></td> <td rowspan="2" align="right" bgcolor='white'><?php echo "<IMG SRC=plaatje.php?plaatje_id=$team_information[0]>";?></td> </tr> <tr class="header"> <td colspan="4">League: <?php echo $league;?></td> </tr> <tr class="rowHeader"> <td>Ground:</td><td colspan="2"><?php echo $team_information[3];?></td> <td>Capacity:</td><td><?php echo $team_information[4];?></td> </tr> <tr class="rowHeader"> <td>Manager: </td> <td colspan="2"><?php echo $user_name;?></td> <td>Partner: </td> <td colspan="1"><?php echo get_partner($team_id, $league_id);?></td> </tr> </tbody> </table> <br /> <!-- dit stuk wordt dynamisch gevuld --> <?php $sql_fixtures = "SELECT f.hometeam_id, f.awayteam_id, f.home_result, f.away_result ". "FROM fixtures_result AS f, league AS l ". "WHERE f.league_id = '" . mysql_real_escape_string($league_id) . "' AND (f.hometeam_id='" . mysql_real_escape_string($team_id) . "' or f.awayteam_id='" . mysql_real_escape_string($team_id) . "') ". "AND f.league_id=l.league_id AND f.week_nr <= l.league_weeknr ". "ORDER BY f.week_nr ASC"; $sql_result = mysql_query($sql_fixtures); ?> <table class="TeamTable" width="100%" cellspacing="0" border="0"> <tr><td valign="top" width="60%"> <table width="100%" cellspacing="0" border="0" class="TeamInfo"> <tr class="header"> <td colspan="5">Results / Fixtures</td> </tr> <tbody> <?php $colourclass = "fixturesLightRow"; while ($row = mysql_fetch_array($sql_result)){ ?> <tr class=<?php echo $colourclass;?>> <td class="TeamTD"> <?php echo get_team_name($row[0]);?> </td> <td class="TeamTD"> <?php echo get_team_name($row[1]);?> </td> <td class="ScoreTD"><?php echo $row[2];?></td> <td class="ScoreTD">-</td> <td class="ScoreTD"><?php echo $row[3];?></td> </tr> <?php if ($colourclass == "fixturesLightRow"){ $colourclass = "fixturesDarkRow"; }elseif ($colourclass == "fixturesDarkRow"){ $colourclass = "fixturesLightRow"; } } ?> </tbody> </table> </td><td valign="top" width="35%"> <?php $sql = "SELECT trophy_year, trophy_name FROM `team_history` where team_id=$team_id ORDER BY trophy_year DESC"; //echo $sql; $result = mysql_query($sql); ?> <table width="100%" cellspacing="0" border="0" class="TeamInfo"> <tr class="header"> <td colspan="5">Team History</td> </tr> <tbody> <?php while ($row = mysql_fetch_array($result)){ ?> <tr> <td valign="top"> <?php echo $row[0]; ?> </td> <td><?php echo $row[1];?></td> </tr> <?php } ?> </tbody> </table> </td> </tr> <!-- einde vandit stuk wordt dynamisch gevuld --> </table> </div> </div> </td> </tr> </tbody> </table> </td> <td class="middleRight"> <img height="1" width="1" alt="" src="images/shim.gif"/> </td> </tr> </tbody> </table> </div> Hi all, I'm currently adding something to my website which makes the user input some information before they enter the site, but I'm getting errors saying.. Notice: Undefined index: realname in /home/a5908246/public_html/next.php on line 24 Notice: Undefined index: gamer in /home/a5908246/public_html/next.php on line 48 But with them errors its not showing the actual form where you post the info into. <?php session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); ini_set ('display_errors', 1); error_reporting (E_ALL); $username = $_SESSION['username']; $get = mysql_query ("SELECT * FROM users WHERE username='$username'") or die (mysql_error()); $got = mysql_fetch_object($get); ?> <html> <head> <title>Please Update..</title> </head> <body> <form action='' method='POST' name='everything'> <?php if ($got->realname == ''){ if ($_POST['realname']){ // Line 24 $input = $_POST['nameinput']; ?> <table width='50%' border='1' class='tableborder2' cellspacing='1' align='center'> <tr> <td class='e_header' align='center'>Error!</td> </tr> <tr> <td class='omg' align='center'>Please Enter your Real Name.</td> </tr> <tr> <td align='center'><input type='text' name='nameinput' class='textinput'></td> </tr> <tr> <td align='center'><input type='button' name='realname' class='button' Value='Update Name!'></td> </tr> </table> <br /> <?php mysql_query ("UPDATE users SET realname='$input' WHERE username='$username'") or die (mysql_error()); }} ?> <?php if ($got->gamertag == ''){ if ($_POST['gamer']){ // Line 48 $inputgamer = $_POST['gamertag']; ?> <table width='50%' border='1' class='tableborder2' cellspacing='1' align='center'> <tr> <td class='e_header' align='center'>Error!</td> </tr> <tr> <td class='omg' align='center'>Please Enter your Gamertag.</td> </tr> <tr> <td align='center'><input type='text' name='gamertag' class='textinput'></td> </tr> <tr> <td align='center'><input type='button' name='gamer' class='button' Value='Update Gamertag!'></td> </tr> </table> <?php mysql_query ("UPDATE users SET gamertag='$inputgamer' WHERE username='$username'") or die (mysql_error()); }} if ($got->realname != '' || $got->gamertag != ''){ // Display, welcome $realname, redirecting you to main site now... (2 seconds waiting) ?> <table width='50%' border='1' class='tableborder2' cellspacing='1' align='center'> <tr> <td class='header' align='center'>Welcome!</td> </tr> <tr> <td class='omg' align='center'>Welcome!</td> </tr> <tr> <td align='center'>You will be redirected to the main site in 2 seconds!<meta http-equiv="refresh" content="2;url=http://******.com/index2.php"></td> </tr> </table> </form> <?php } ?> Thanks for any help/advice given Hi all, I am fairly new to php. I am learning php by a book.' I am getting an undefined index error. With the following code in dreamweaver. <?php if ($row_rsCoffee['image'] == "") { echo '<img src="images/missing_image.jpg" />'; } else { echo '<img src="images/' . $row_rsCoffee['image'] . '" />'; } ?> The line the error is at: ($row_rsCoffee['image'] == "") --> Notice: Undefined index: image in C:\wamp\www\coffee\coffeevarieties.php Can anyone help with this>? Thanks in advance. Alexander Lejuez Hi guys I am getting an error of Code: [Select] Notice: Undefined index: photo_filename in /home/sites/haldonguesthouse.co.uk/public_html/new-site/admin/upload.php on line 28 I understand that the error would suggest that the field is not referenced on the form that is used to post the values through. Below is the form code that is used to post the values Code: [Select] <form id="add_gallery" action="upload.php" method="post"> <table> <tr> <td>Gallery Name</td> <td><select name="category" id="category"> <option>Please select...</option> <option value="14">Superior Double Room</option><option value="15">Superior Single Room</option><option value="16">Double en-suite</option><option value="17">Twin or Triple Room, en suite</option><option value="18">Family Room for 4</option><option value="19">Single Room with Private Facilities</option><option value="20">Double Room with Private Facilities</option><option value="21">The Gallery</option></select></td> </tr> <tr> <td> Photo 1: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 2: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 3: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 4: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 5: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 6: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 7: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 8: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 9: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 10: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td></td><td><input type="submit" name="submit" value="Upload Photos"/></td> </tr> </table> </form> Undefined index: name in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 Undefined index: mobile in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 Undefined index: email in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 Code: [Select] <?php include("connect.php"); if(!$cn) { die('could not connect' . mysql_error); } $qry=mysql_query("SELECT * FROM pro"); while($row=mysql_fetch_array($qry)) { $name=$row['name']; $mobile=$row['mobile']; $email=$row['email']; } echo "<h3>Profiles</h3><br/><br/>"; echo "Name: <input type=\"text\" name=\"char\" value=\"$name\"> "; echo "<br/>"; echo "Mobile: <input type=\"text\" name=\"number\" value=\"$mobile\"> "; echo "<br/>"; echo "Email: <input type=\"text\" name=\"mail\" value=\"$email\"> <br/>"; echo "<form action=\"update.php\" method=\"post\">"; echo "<input type=\"submit\" name=\"submit\" value=\"submit\">"; ?> Hi I am new in PHP scripting. I wrote a small script but stuck in the below error message.. Can someone please correct the code? Thanks in advance. Kapil Notice: Undefined index: submitbutton in C:\xampp\htdocs\index.php on line 30 Error in code <?php echo "<title>PHP File Upload </title>"; $form = "<form action='index.php' method='POST' enctype='multipart/form-data'> <table> <tr> <td>Title : </td> <td><input type = 'text' name = 'title'> </td> </tr> <tr> <td>Description : </td> <td><textarea name ='description' cols ='35' rows = '5'> </textarea></td> </tr> <tr> <td> </td> <td><input type = 'file' name = 'myfile'> </td> </tr> <tr> <td> </td> <td><input type = 'submit' name ='submitbutton' value ='Submit'></td> </tr> </table> </form>"; if($_POST['submitbutton']) { $name = $_FILES['myfile']['name']; echo "$name"; } else { echo "Error in code"; } ?> want to carry over session to help page? but getting the error undefined index. Any help would be greatly appreciated! //getting my value from database table and put it into session $_SESSION["user_firstname"] = $data["Firstname"]; //decides on where the user gets re-directed to. if ($_SESSION["user_priority"] == '1') { header("Location: AdminSection.php"); } else { header("Location:LoggedIn.php"); } if ($_SESSION["user_times_loggged_in"] == '0') { header("Location:UsingTheSystem.php"); } //Help page <?php session_start(); $name = $_SESSION["user_firstname"]; echo $name; ?> any idea why its not picking up the session? Thanks |