PHP - Strange Undefined Variable And Undefined Index Notices
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. Similar Tutorialshi, 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 Ok I have this code.. Code: [Select] <?php header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 session_start(); if (!isset($_SESSION['SESSION'])) require ( "../db_connection.php"); ?> <!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>User Registration Form</title> </head> <body><center><br /><br /> <form name="registration" method="post" action="/php/user_registration/registered.php"> <table> <tr> <td>First Name:</td> <td><input type="text" name="fname" value="<?php $_SESSION['fname'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="lname" value="<?php $_SESSION['lname'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>E-Mail Address:</td> <td><input type="text" name="email" value="<?php $_SESSION['email'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>Phone:</td> <td><input type="text" name="phone" value="<?php $_SESSION['phone'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>City:</td> <td><input type="text" name="city" value="<?php $_SESSION['city'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>Status:</td> <td> <select name="status" id="status"> <option>Pls. Select One <option value="single">Single <option value="relationship">In a Relationship <option value="complicated">It's Complicated </select> </td> </tr> <tr> <td>Province:</td> <td><input type="text" name="province" value="<?php $_SESSION['province'] ?>" size="30" maxlength="50" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" size="30" maxlength="50" /></td> </tr> <tr> <td>Confirm Password:</td> <td><input type="password" name="password2" size="30" maxlength="50" /></td> </tr> <tr> <td> <input type="reset" name="Submit2" value="Reset"></td> <td> <input type="button" name="Submit" value="Submit" onclick="SubmitForm(); return false;" ></td> </tr> </table> </form> </center> </body> </html> I'm not actually doing anything yet up there though I'm having an error on row "province". The error is Quote Undefined index: province in C:\wamp\www\php\user_registration\registration_form.php on line 75 I have tried almost everything and of all the rows I have there, that's the only one I'm having error at. I'm curious why I'm getting that error. Anyone? I have been working on a PHP site on an actual server that is online. This is bad practice, and a huge pain in the ass as I need to upload all files to test whether the work. So I've installed XAMPP and have transferred my database and website to the root folder. Now I get these errors: Notice: Undefined index: username in C:\xampp\htdocs\members.html on line 19 This error is produced he Code: [Select] session_start(); $fc_user = ''; $fc_pass = ''; if (isset($_SESSION['fc_handle']) && isset($_SESSION['fc_password'])) { $fc_user = $_SESSION['fc_handle']; $fc_pass = base64_encode($_SESSION['fc_password']); } else if (isset($_POST['username']) && isset($_POST['password'])) { $fc_user = $_POST['username']; $fc_pass = base64_encode($_POST['password']); } else if ((($_POST['username'] == '') || ($_POST['password'] == '')) && (($_SESSION['fc_handle'] == '') || ($_SESSION['fc_id'] == ''))) /// <-- THIS IS LINE 19 { header("Location: http://www.familychores.com/index_coming.html"); exit; } I can't figure this out ... Sorry again , but it seems I still have some problem with my $_GET. Here is the error I get: Notice: Undefined variable: id in /opt/lampp/htdocs/EMC/customer-search.php on line 248 Notice: Undefined index: Page in /opt/lampp/htdocs/EMC/customer-search.php on line 255 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/EMC/customer-search.php on line 302 And my code for second error: Code: [Select] $Per_Page = 2; // Per Page $Page = isset($_GET["Page"]); if (!$_GET["Page"]) { $Page=1; } I'm not really sure what's the problem with my first and third error so I will post the whole code he Code: [Select] <?php require_once("./include/fg_membersite.php"); require_once("./include/membersite_config.php"); $objConnect = mysql_connect("localhost","root","") or die(mysql_error()); $objDB = mysql_select_db("EMC"); $haha = $fgmembersite->UserEmail(); $_SESSION['storedemail']= $haha; $query4 = mysql_query("SELECT * FROM Register WHERE Email= '$haha'"); while ($row4 = mysql_fetch_array($query4)){ $id = $row4['ID']; } mysql_free_result($query4); ?> <html> <body> <form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>"> <table width="599" border="1"> <tr> <th>Keyword <input name="txtFirstName" type="text" id="txtFirstName" value="<?= isset($_GET["txtFirstName"]) ;?>"> <input name="txtLastName" type="text" id="txtLastName" value="<?= isset($_GET["txtLastName"]) ;?>"> <input name="txtCell" type="text" id="txtCell" value="<?= isset($_GET["txtCell"]) ;?>"> <? $opselect="SELECT DISTINCT Custgroup FROM UserAddedRecord"; $result = mysql_query ($opselect); while($nt=mysql_fetch_array($result)) { ?> <option><?= $nt[Custgroup]?></option>"; <? } ?> </select> <input type="submit" value="Search"> </tr> </table> </form> <? if (isset($_GET["txtFirstName"]) != "" || isset($_GET["txtLastName"]) != "" || isset($_GET["txtCell"]) != "" || isset($_GET["txtGroup"]) != "") { $objConnect = mysql_connect("localhost","root","") or die(mysql_error()); $objDB = mysql_select_db("EMC"); // Search By Name or Email $strSQL = "SELECT * FROM UserAddedRecord WHERE (FirstName LIKE '%".$_GET["txtFirstName"]."%' and LastName LIKE '%".$_GET["txtLastName"]."%' and Cell LIKE '%".$_GET["txtCell"]."%' and Custgroup LIKE '%".$_GET["txtGroup"]."%')"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 2; // Per Page $Page = isset($_GET["Page"]); if (!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by addedrec_ID DESC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="600" border="1"> <tr> <th width="50"> <div align="center">#</div></th> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?=$objResult["addedrec_ID"];?>"></div></td> <td><div align="center"><?=$objResult["addedrec_ID"];?></div></td> <td><?=$objResult["FirstName"];?></td> <td><?=$objResult["LastName"];?></td> <td><div align="center"><?=$objResult["MobileCompany"];?></div></td> <td align="right"><?=$objResult["Cell"];?></td> <td align="right"><?=$objResult["Workphone"];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { if($_GET["txtFirstName"] == "") { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtLastName=$_GET[txtLastName]'><< Back</a> "; } else { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtFirstName=$_GET[txtFirstName]'><< Back</a> "; } } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtFirstName=$_GET[txtFirstName]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "" && $_GET["txtCell"] == "") { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtGroup=$_GET[txtGroup]'>Next>></a> "; } else if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "") { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtCell=$_GET[txtCell]'>Next>></a> "; } else if($_GET["txtFirstName"] == "" ) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtLastName=$_GET[txtLastName]'>Next>></a> "; } else { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtFirstName=$_GET[txtFirstName]'>Next>></a> "; } } mysql_close($objConnect); } else { $strSQL = "SELECT * FROM UserAddedRecord WHERE user_id='$id'"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 2; // Per Page $Page = isset($_GET["Page"]); if (!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by id DESC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="600" border="1"> <tr> <th width="50"> <div align="center">#</div></th> <th width="91"> <div align="center">ID </div></th> <th width="198"> <div align="center">First Name </div></th> <th width="198"> <div align="center">Last Name </div></th> <th width="250"> <div align="center">Mobile Company </div></th> <th width="100"> <div align="center">Cell </div></th> <th width="100"> <div align="center">Workphone </div></th> <th width="100"> <div align="center">Group </div></th> </tr> <? echo "<form name='form1' method='post' action=''>"; while($objResult = mysql_fetch_array($objQuery)) { echo "<tr>"; echo "<td align='center'><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$objResult[addedrec_ID]\"></td>"; echo "<td>$objResult[addedrec_ID] </td>"; echo "<td>$objResult[FirstName]</td>"; echo "<td>$objResult[LastName] </td>"; echo "<td>$objResult[MobileCompany] </td>"; echo "<td>$objResult[Cell] </td>"; echo "<td>$objResult[WorkPhone] </td>"; echo "<td>$objResult[Custgroup] </td>"; echo "</tr>"; } echo "<td colspan='7' align='center'><input name=\"delete\" type=\"submit\" id=\"delete\" value=\"Delete\">"; if(isset($_POST['delete'])) // from button name="delete" { $checkbox = $_POST['checkbox']; //from name="checkbox[]" $countCheck = count($_POST['checkbox']); for($d=0;$d<$countCheck;$d++) { $del_id = $checkbox[$d]; $sql = "DELETE from UserAddedRecord where addedrec_ID = $del_id"; $result2=mysql_query($sql); } if($result2) { header('Location: customer-adddata.php'); } else { echo "Error: ".mysql_error(); } } echo "</form>"; ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { if($_GET["txtFirstName"] == "") { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtLastName=$_GET[txtLastName]'><< Back</a> "; } else { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtFirstName=$_GET[txtFirstName]'><< Back</a> "; } } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtFirstName=$_GET[txtFirstName]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "") { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtCell=$_GET[txtCell]'>Next>></a> "; } else if($_GET["txtFirstName"] == "" ) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtLastName=$_GET[txtLastName]'>Next>></a> "; } else { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtFirstName=$_GET[txtFirstName]'>Next>></a> "; } } mysql_close($objConnect); } ?> </body> </html> And one more error , when I tried to search data and typed some keywords in the textbox , three of the textbox will keep return me value "1" , I really tried to solve the error but still there....can anyone help me for this? Thanks in advanced. I have a php page that is trying to pass a variable like this: echo "<tr><td bgcolor='white'>" . $company_id . "</td><td bgcolor='white'><a href='companyusers.php?name=" . $company_name . "'>" . $company_name . "</a></td><td bgcolor='white'>" . $company_email . "</td><td bgcolor='white'>" . $company_status . "</td></tr>"; Then when some one clicks on that link they variable with it's value should go with the url and I'm trying to assign a variable like this: $company_name = $_POST['name']; It is not working!!! I get that "Notice: Undefined index: name in 'directory of page' on line 100" Can someone help please? 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 I am pretty sure I defined these, by making it something like $blah="blah" and `blah` = ' {$blah}' So why am I getting these errors = Notice: Use of undefined constant petid - assumed 'petid' in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 38 Notice: Use of undefined constant adopter - assumed 'adopter' in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 41 Notice: Undefined variable: fulldate in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 44 Fatal error: Call to undefined function showpet_forum() in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 45 $time = mysql_query("SELECT * FROM `pets_adopted`"); $date = mysql_fetch_array($time); $fulldate = "$date[fulldate]"; $halfdate = "$date[halfdate]"; function check(){ $pid = mysql_real_escape_string($_GET['id']); $result = mysql_query("SELECT * FROM `pets_adopted` WHERE `id` = '{$pid}'"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $results = mysql_query("SELECT * FROM `pets_list` WHERE `id` = '{$row[petid]}'"); $pet = mysql_fetch_array($results); $results2 = mysql_query("SELECT * FROM `users` WHERE `id` = '{$row[adopter]}'"); $usercc = mysql_fetch_array($results2); There's the snippet. Thank you for any help. I am just really lost. I 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 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 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"; } ?> On Line 65 there is an error stating this: Notice: Undefined index: tab in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\tab.php on line 65 Line 65 is: $tab=$_REQUEST["tab"]; I honestly don't understand how to fix it. I've tried and I've had no luck. If you can help, I'll appreciate it! I'm pretty new to PHP so I'm not the most fluent at it. All of my coding is below. Thanks! Code: [Select] <!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>Round Tabs With PHP</title> <style> #tabs{ padding-right:20px; /* The right most tab will be padded 20px from its right */ margin:0px; float:right; /* For right aligned tabs */ } #tabs a{ background:#000 url(images/left_tab.gif) top left no-repeat; /* Background image is positioned top, left */ color:#FFF; padding-left:5px; /* Change this padding according to the size of image slices used to create tab */ text-decoration:none; } #tabs a:hover{ background:#edcb27 url(images/selected_left_tab.gif) top left no-repeat; color:#000; text-decoration:none; } #tabs a span{ background:#000 url(images/right_tab.gif) top right no-repeat; /* Note the position of background image */ color:#FFF; padding-right:15px; } #tabs a:hover span{ background:#edcb27 url(images/selected_right_tab.gif) top right no-repeat; color:#000; } #tabs li{ list-style:none; float:left; padding-left:3px; } #tabs b{ /* This class will be applied on selected tab */ background:#edcb27 url(images/selected_left_tab.gif) top left no-repeat; color:#FFF; padding-left:5px; font-weight:normal; } #tabs b span{ background:#edcb27 url(images/selected_right_tab.gif) top right no-repeat; color:#000; padding-right:15px; } #tabs span{ font-family:Arial, Helvetica, sans-serif; font-size:12px; padding:6px; cursor:pointer; } #tabs a,#tabs a span,#tabs b,#tabs b span{ display:block; /* Set display to block, otherwise background images will not work*/ float:left; } </style> </head> <body> <?php $tab=$_REQUEST["tab"]; if($tab=='') $tab='home'; ?> <ul id="tabs"> <?php if($tab=='home'){ ?> <li><b><span>Home</span></b></li> <? }else{ ?> <li><a href="?tab=home"><span>Home</span></a></li> <?php } ?> <?php if($tab=='products'){ ?> <li><b><span>Products</span></b></li> <?php }else{ ?> <li><a href="?tab=products"><span>Products</span></a></li> <?php } ?> <?php if($tab=='services'){ ?> <li><b><span>Services</span></b></li> <?php }else{ ?> <li><a href="?tab=services"><span>Services</span></a></li> <?php } ?> <?php if($tab=='downloads'){ ?> <li><b><span>Downloads</span></b></li> <?php }else{ ?> <li><a href="?tab=downloads"><span>Downloads</span></a></li> <?php } ?> </ul> <div style="clear:both; background-color:#edcb27; height:0px; overflow:hidden;"></div> <div style="clear:both; background-color:#edcb27; height:0px; overflow:hidden;;"></div> <div style="border:solid 3px #edcb27; background-color:#edcb27; padding:10px; font-family:Verdana, Geneva, sans-serif; font-size:11px;;;"> <?php if($tab=='home'){ ?> The text for home tab goes here .......... <?php } else if($tab=='products'){ ?> The text for products tab goes here ... <?php } else if($tab=='services') { ?> The text for services tab goes here ... <?php } else if($tab=='downloads') { ?> The text for downloads tab goes here ... <?php } ?> </div> </body> </html> I've got this on my page index.php $rand = $_SESSION['rand']; if (empty($rand)) { srand((float)microtime()*1000003); $rand = rand(); $_SESSION['rand'] = $rand; } On all my other pages i've got this <?php unset($_SESSION['rand']) ?> The problem is that if I go to any other page than index it will unset the session 'rand'. If I then go back to index.php I get this error 'Notice: Undefined index: rand' is there a way to get around this? Hi, I would like to pass the value of a form name through "rsTown" but I am getting undefined index my form: Code: [Select] <form method="post" class="textbox" action="<?php print $_SERVER["PHP_SELF"]; ?>"> City/Town: <input type="text" size="26" class="searchbox" value="" name="rsTown" 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> my code on same page: Code: [Select] <? $Townsearch = $_REQUEST['rsTown']; // how many rows to show per page $rowsPerPage = 20; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT * FROM pubs WHERE rsTown LIKE '$Townsearch%' LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die(mysql_error().'<br>SQL: ' . $query); //looping counties $query1 = "SELECT rsCounty, COUNT(PubID) AS County_Count FROM pubs GROUP BY rsCounty"; $result1 = mysql_query($query1) or die(mysql_error().'<br>SQL: ' . $query1); $county_select_options = '<option value="">Search county</option>'; while ($row = mysql_fetch_assoc($result1)) { $counties[$row['rsCounty']] = $row['County_Count']; // $county_select_options .= '<option value="display.php?PubID='.$row['id'].'">'.$row['rsCounty'].' (x'.$row['County_Count'].')</option>'."\n"; } // make this arrays not strings: $values = array(); $labels = array(); // compute the sum: $total = array_sum($counties); foreach($counties as $rsCounty=>$count){ // compute percent and add to values list: $values[] = ($count*100/$total); $labels[] = $rsCounty; } // convert array $values to a string comma separated $values = implode(',',$values); // same conversion for $labels but '|' separated $labels = implode('|', $labels); $url = 'http://chart.apis.google.com/chart?cht=p3&chd=t:'.$values.'&chs=480x200&chl='.$labels.'&chco=b0d584'; ?> <img src="<?php echo $url ?>" /> <? // start main page while($row = mysql_fetch_array($result)){ echo '<div id="pubholder" class="wrap">'; $PUBID = $row['PubID']; $RSPUBNAME = $row['rsPubName']; $RSADDRESS = $row['rsAddress']; $RSPOSTCODE = $row['rsPostCode']; $RSTEL = $row['rsTel']; $RSTOWN = $row['rsTown']; $RSCOUNTY = $row['rsCounty']; //div container of header and information echo <<<EOF <a title="$PUBID" id="$PUBID" name="$PUBID"></a> <div class="entry_header"> <div class="pubname">$RSPUBNAME</div> EOF; if ($_SESSION["RSUSER"] == "admin") { echo "<a href=\"edit.php?PUBID=$PUBID\" class=\"small\">edit this pub</a>"; } echo "</br>"; echo "</br>"; echo "<div class=\"county\">".$RSCOUNTY."</div><div class=\"town\">".$RSTOWN."</div>"; echo "</div>"; echo "</div>"; } // how many rows we have in database $query = "SELECT COUNT(*) AS numrows FROM pubs"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the page navigation link echo "<div class=\"centertext\">"; echo $first . $prev . $nav ." Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong> pages " . $next . $last; echo "</div>"; ?> Also, I need my pagination sorting out if anyone can help?! take a look at my site: http://www.retroandvintage.co.uk/default.php 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 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 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. i got a problem on undefined index...but if i use Xampp i can run in nicely with our error..but in wamp it say undefined index... what i supposed to do.... so that i can run it in both xampp and wamp nicely |