PHP - Undefined Variable? Basic Mistake... ~sigh~
Still forgetting it. Code: [Select] <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $data = array(); class Main extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('html'); $this->load->helper('url'); $this->load->library('ion_auth'); $this->load->library('session'); $this->load->library('form_validation'); $this->load->database(); //$this->load->model('prod_m'); } function login() { $this->$data['header'] = $this->load->view('header', null, TRUE); $this->load->view('front_page', $this->data); } } /* End of file main.php */ /* Location: ./application/controllers/main.php */ All I just is to make the $data array variable as public and works across all function inside the class. Where did I made wrong? Thanks in advance. Similar TutorialsHi there, First of all, I want to present the diagram that I'm working on. ----------- Diagram ----------- step2_a.php --| step2_b.php --|---> output.php step2_c.php --| (Process is included here) step2_d.php --| and here are the corresponding codes: step2_x: Code: [Select] . . . <form action="output.php" method="post" name="a"> req1: <input type="text" name="a_req_1"> req2: <input type="text" name="a_req_2"> . . . <input type="submit"> </form> ------ . . . <form action="output.php" method="post" name="b"> req1: <input type="text" name="b_req_1"> req2: <input type="text" name="b_req_2"> . . . <input type="submit"> </form> . . . . . . output.php: Code: [Select] <?php $form_name = $_POST['a']; if($form_name = "a") { //variables for a goes here //code goes here } elseif($form_name = "b") { //variables for b goes here //code goes here } elseif($form_name = "c") { //cariables for c goes here //code goes here } elseif($form_name = "d") { //variables for d goes here //code goes here } else { //code goes here } ?> Now, here's the problem. output.php always sees the primary condition as true. Even the data came from step2_b, the code does not recognize it. I tried to use "==" instead of "=" but the code sees the arguments as false so it executed the code on "else". How can I make the code distinguish the source of the data so that it would execute the right set of commands? Thanks in advance. 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. 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 have just re-installed Xampp and suddenly my sites are now displaying lots of: Notice: Use of undefined constant name - assumed 'name' in ... Notice: Use of undefined constant price - assumed 'price' in ... this is an example of the line its refering too: $defineProducts[1001] = array(name=>'This is a product', price=>123); 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 I just moved my code from Appserv to EasyPHP and it gave me this error, it was working fine on Appserv...what's with easyPHP ?? I can't figure out how I'm messing up so badly. Anyway, I have:
$con=mysqli_connect("removedforsecurity"); $finderCleanup = mysqli_query($con, "SELECT * FROM Entries ORDER BY PID DESC LIMIT 1"); $finderCleanupArray = mysqli_fetch_array($finderCleanup); $integerCleanup = $finderCleanupArray['PID'] - 40; $lastPID = $finderCleanupArray['PID']; $lastPIDreduced = $finderCleanupArray['PID'] - 8;When I var_dump $lastPID, it returns INT with a number (it works correctly.) Then, I have this: function getResults($con,$lastPIDreduced)$con works correctly in the function, but $lastPIDreduced is "undefined." What is my sin? Thanks. Hi All, I'm having a major mind blank, and can't find anything in the previous posts resolving what I'm after. I'm setting $searchtext = $_POST['searchtext']; I want to check $seachtext is not null. I've seen isset($searchtext) but it doesn't solve my problem. Basiclaly; I want an if statement to say if(isset($searchtext)) {......} Thoughts? When I run the MySQL queries in the code below in SQLyog, the $pokemon_pos in the "SELECT max(pokemon_pos)" part of the statement is always correct (i.e. alias "x" is correct). Yet when wrapped up in PHP, $newpos, which relies on "x" is always undefined. I'd greatly appreciate any help in troubleshooting this code - Code: [Select] $getdeclined="SELECT * FROM trade_offers WHERE pokemon_trade_id=$_GET[id]"; $declined=mysql_query($getdeclined); while ($row = mysql_fetch_array($declined)){ $getdecusername="SELECT MAX(pokemon_pos) FROM ( SELECT pokemon_pos FROM pokemon_trainer WHERE pokemon_trainer = '$row[pokemon_trainer]' UNION SELECT pokemon_pos FROM trade_offers WHERE pokemon_trainer = '$row[pokemon_trainer]' AND pokemon_trade_id = $_GET[id] ) AS x"; $decusername=mysql_query($getdecusername); while($row2 = mysql_fetch_array($decusername)){ $newpos = $row2['x'];} echo $newpos; $newpos +=1; } } I had some help righting this query and the extensive coding here and most of it I understand however when i run this it gives me an undefined variable charname error and I'm trying to understand why. Does the coding make sense to anyone? <?php $query = "SELECT ecm.name AS fighters, ecb.id AS showid, ecm.id AS matchid, ecb.bookingdate AS bookingdate, ecb.event_id AS event_id, els.name AS name, ecb.label AS label FROM `efed_content_appearances` AS eca INNER JOIN `efed_content_matchseg` AS ecm ON eca.content_id = ecm.id INNER JOIN `efed_content_booking` AS ecb ON ecm.booking_id = ecb.id INNER JOIN `efed_list_shownames` AS els ON ecb.event_id = els.id WHERE eca.bio_id = '$id' AND eca.type = 'match' ORDER BY ecb.bookingdate DESC, ecm.sortorder ASC"; $result = mysql_query($query); if(mysql_num_rows($result) == 0){ echo '<td colspan="3" class="noseg">This wrestler has never been in an event match.</td>' ; } else{ $count = 1; while($row = mysql_fetch_assoc($result)){ $fighter = explode(' vs. ', $row['fighters']); $opponents = ''; for($i = 0; $i < count($fighter); $i++){ if($fighter[$i] != $charname){ if($opponents != ''){ $opponents .= ', '; } $opponents .= $fighter[$i]; } } echo '<table cellspacing="0px" style="text-align: center;"><tr class="titlebar"><td>Date</td><td>Show</td><td>Opponent/s</td></tr>'; echo '<tr class="row' . $count . '"><td>' . convertdate($row['bookingdate']) . '</td><td><a href="content.php?p=results&show=' . $row['event_id'] . '&id=' . $row['showid'] . '#' . $row['matchid'] . '">' . $row['name'] . ' ' . $row['label'] . '</a></td><td>' . $opponents . '</td></tr>'; echo '</table>'; if($count == 1){ $count = 2; } else { $count = 1; } } } ?> I'm getting: Quote PHP Notice: Undefined variable: carttotal ... for this: $idtotal = $sizestotal + $sizemtotal + $sizeltotal + $sizexltotal; $carttotal += $idtotal; Why? Hey Guys. I Have a quick questions. I keep getting an "undefined variable" when php parses the following code
echo "<div class='menu'>${$this->price}</div>"."<br>";However when I put a space after the dollar sign it works fine... echo "<div class='menu'>$ {$this->price}</div>"."<br>";Doesn't the curly braces tells php to seperate strings from variables? I'm a little bit confused. Thanks! Why does php show undefined variable? I researched and found out that if the variables aren't set then they will likely show undefined variable. However, I used the isset function to check if the variable is undefined and if it is then set it to $varaible ="" . That didn't work and then later i tried $variable = NULL. What should I do Can you please see the code and tell me what shall i do. Thanks a million
<?php require_once("includes/connection.php")?> <?php require_once("includes/function.php") ?> <?php require_once("includes/header.php") ?> <?php if(isset($_GET['subj'])){ $sel_subj = NULL; $sel_subj = $_GET['subj']; } elseif (isset($_GET['page'])){ $sel_page = NULL; $sel_page = $_GET['page'] ; } else { $sel_subj= NULL; $sel_page =NULL; } ?> <table id = "structure" > <tr> <td id = "navigation" > <ul class= "subjects" > <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)){ // <a href = "content.php?subj=1" > if ($sel_subj == $subject["id"]){ echo "<li class = \"selected\" "; }else{ echo "<li> "; } "<a href = \"content.php?subj=" . urlencode($subject["id"]) . "\">" . $subject["menu_name"]. "</a></li>" ; $page_set = get_pages_for_subjects( $subject["id"] ) ; echo " <ul class = \"pages\"> "; while ($page = mysql_fetch_array($page_set)){ echo "<li><a href = \"content.php?page=" . urlencode($page["id"]) . "\">" . $page["menu_name"] . "</a></li>" ; } echo "</ul>" ; } ?> </ul> </td> <td id= "page" > <h1> Main Area To Get Your Information </h1> <?php echo $sel_subj ; ?> <br/> <?php echo $sel_page ; ?> <br/> </td> </tr> </table> <?php include ("includes/footer.php") ?>The variable im refering to is $sel_subj and $sel_page at the top of the code. Here is an attachment of the error Attached Files Capture.PNG 275.47KB 0 downloads Hi guys.
why is my function error: undefined varable pdo?
Thanks
function referralCount($uid,$reflvl) { $stmt= $pdo->query("SELECT * FROM scraffiliateusr WHERE usrinvby='$uid'"); $nusrref1 = $stmt->rowCount(); //$arrusrref1 = $stmt->fetch(PDO::FETCH_LAZY); $reflvl1=$nusrref1; $ttlreflvl2="0"; $ttlreflvl3="0"; for ($i=0; $i<$nusrref1; $i++) { $arrusrref1 = $stmt->fetch(PDO::FETCH_LAZY); $stmt= $pdo->query("SELECT * FROM scraffiliateusr WHERE usrinvby='$arrusrref1[0]'"); $nusrref2 = $stmt->rowCount(); //$arrusrref2 = $stmt->fetch(PDO::FETCH_LAZY); $ttlreflvl2=$ttlreflvl2+$nusrref2; for ($j=0; $j<$nusrref2; $j++) { $arrusrref2 = $stmt->fetch(PDO::FETCH_LAZY); $stmt= $pdo->query("SELECT * FROM scraffiliateusr WHERE usrinvby='$arrusrref2[0]'"); $nusrref3 = $stmt->rowCount(); //$arrusrref3 = $stmt->fetch(PDO::FETCH_LAZY); $ttlreflvl3=$ttlreflvl3+$nusrref3; } } $reflvl2=$ttlreflvl2; $reflvl3=$ttlreflvl3; if($reflvl=='1') { return($reflvl1); } elseif($reflvl=='2') { return($reflvl2); } elseif($reflvl=='3') { return($reflvl3); } } can anyone help with this function. i keep getting undefined variable: link error. function simple_query($fields, $table, $clause, $order) { if (empty($config)) { require("./config/config.php"); } if(!empty($clause)) { $clause = "WHERE $clause"; } if(!class_exists('db_mysqli')) { include('./includes/db_mysqli.php'); $link = new db_mysqli; $link->connect($config['database']); } if(!empty($order)) { $direction = $order[0]; switch($direction) { case "0": $direction = "ASC"; break; case "1": $direction = "DESC"; break; } $order = substr($order, 1, strlen($order)); $order = "ORDER BY $order $direction"; } $query = $link->query("SELECT $fields //THIS LINE THROWS THE ERROR FROM ".TBL_PREFIX."$table $clause $order")or die(mysqli_error($link)); return $query; } database class: class db_mysqli { public $link; function connect($settings) { require_once(dirname(dirname(__FILE__)).'/config/config.php'); $link = new mysqli($settings['hostname'], $settings['username'], $settings['password'], $settings['database']); $this->link = $link; } } thanks. Hi all, When i run the code below he gives the variable $naantal below he got the number i put in with ?undefined after it. Code: [Select] <?php $id = $_GET["id"]; $naantal = $_GET["aantal"]; $wijzig ="UPDATE care_medicijnen SET aantal=$naantal WHERE $id=id"; echo $wijzig; if(isset($_GET["id"])) { mysql_query($wijzig); } ?> When my input is the number 8 he gives this as output: Quote UPDATE care_medicijnen SET aantal=8?undefined WHERE 4160962=id How can i fix this that i only got the number 8 without ?undefined after it. already thanks Very new to PHP. But I'm running through some tutorials here and there and I was working on this script to calculate test scores. Could someone please assist? This is also my first post so I'm hoping it's in the right place. Thanks in advance! It is also attached if anyone needs a reference. It is reporting: Quote Notice: Undefined variable: test_complete in C:\xampp\htdocs\lascelles\quizscriptV2.php on line 16 Code: [Select] <? $page_title = "Calculate Test Scores"; // This runs a script when the form is submitted. if(isset($_POST['submit'])){ $quest1 = $_POST['quest1']; $quest2 = $_POST['quest2']; $quest3 = $_POST['quest3']; $quest4 = $_POST['quest4']; $quest5 = $_POST['quest5']; // Lets make sure that everything has been submitted if($quest1 == NULL OR $quest2 == NULL OR $quest3 == NULL OR $quest4 == NULL OR $quest5 == NULL) { $test_complete .='Please complete the test! <a href="javascript:history.go(-1)">Go Back</a>'; }else{ // change the quest1 to the right answer if($quest1 == "3") { $test_complete .="Question one is <span class='green'>correct</span>, well done!<br/>"; }else{ $test_complete .="Question one is <span class='red'>incorrect</span>!<br/>"; } // change the quest2 to the right answer if($quest2 == "2") { $test_complete .="Question two is <span class='green'>correct</span>, well done!<br/>"; }else{ $test_complete .="Question two is <span class='red'>incorrect</span>!<br/>"; } // change the quest3 to the right answer if($quest3 == "1") { $test_complete .="Question three is <span class='green'>correct</span>, well done!<br/>"; }else{ $test_complete .="Question three is <span class='red'>incorrect</span>!<br/>"; } // change the quest4 to the right answer if($quest4 == "3") { $test_complete .="Question four is <span class='green'>correct</span>, well done!<br/>"; }else{ $test_complete .="Question four is <span class='red'>incorrect</span>!<br/>"; } // change the quest5 to the right answer if($quest5 == "2") { $test_complete .="Question five is <span class='green'>correct</span>, well done!<br/>"; }else{ $test_complete .="Question five is <span class='red'>incorrect</span>!<br/>"; } // Now lets see if all the questions are correct, this must match the above quest settings if($quest1 == "3" & $quest2 == "2" & $quest3 == "1" & $quest4 == "3" & $quest5 == "2"){ $test_complete .="<p>Congratulations, you got all the questions correct!</p>"; }else{ // If any of the questions are not correct lets tell them $test_complete .='<p>Try again next time! <a href="javascript:history.go(-1)">Try again</a></p>'; }}} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Calculate Test Scores</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> <!-- body,td,th { color: #000000; } .green {color:#009933;} .red {color:#CC0000;} --> </style></head> <body> <? if(!isset($_POST['submit'])){ ?> <h2>Calculate Test Scores</h2> <p>Please answer the following questions.</p> <form method="post"> <p>1. Do you like tests?<br> <input type="radio" name="quest1" value="3"> Yes<br> <input type="radio" name="quest1" value="2"> Maybe<br> <input type="radio" name="quest1" value="1"> No</p> <p>2. Do you like multiple choice?<br> <input type="radio" name="quest2" value="1"> Some times<br> <input type="radio" name="quest2" value="3"> Never<br> <input type="radio" name="quest2" value="2"> Always</p> <p>3. Do you study hard?<br> <input type="radio" name="quest3" value="2"> No<br> <input type="radio" name="quest3" value="1"> Yes<br> <input type="radio" name="quest3" value="3"> Not sure</p> <p>4. Do you like PHP?<br> <input type="radio" name="quest4" value="3"> Yes <br> <input type="radio" name="quest4" value="2"> Never <br> <input type="radio" name="quest4" value="1"> Maybe </p> <p>5. Do you enjoy programming? <br> <input type="radio" name="quest5" value="3"> Nope <br> <input type="radio" name="quest5" value="2"> Always<br> <input type="radio" name="quest5" value="1"> Never </p> <p> <input type="submit" name="submit" value="Calculate Score"> </p> </form> <? }else{ echo "<h2>Quiz Results</h2> <p>".$test_complete ."</p>"; }?> </body> </html> I am following this tutorial here http://youtu.be/WrbaISEEihM. When i try to edit a product in my inventory i get an error "Undefined variable: product_list in /home/a7064593/public_html/storeadmin/inventory_edit.php on line 85" and i cant work out how to fix it. here is my code http://pastebin.com/k36tBjEL. Thanks Notice: Undefined variable: quantity_row in C:\xampp\htdocs\cart\cart.php on line 12 Notice: Undefined index: cart_1 in C:\xampp\htdocs\cart\cart.php on line 12 Notice: Undefined index: cart_1 in C:\xampp\htdocs\cart\cart.php on line 30 Help me guys Code: [Select] <?php session_start(); $page = 'index.php'; mysql_connect('localhost','root','')or die(mysql_error()); mysql_select_db('cart') or die(mysql_error()); if (isset ($_GET['add'])){ $quantity = mysql_query('SELECT id, quantity FROM products WHERE id ='.mysql_real_escape_string( (int)$_GET['add'])); while($quantity_rows = mysql_fetch_assoc($quantity)) { if ($quantity_row['quantity'] != $_SESSION['cart_'.$_GET['add']]) { $_SESSION['cart_'.$_GET['add']] += '1'; } } } function products() { $get = mysql_query('SELECT id, name, description, price FROM products WHERE quantity > 0 ORDER BY id DESC') or die(mysql_error()); if (mysql_num_rows($get) == 0) { echo 'There are no products to display!'; } else { while ($get_row = mysql_fetch_assoc($get)) { echo '<p>'.$get_row['name']. '<br />' .$get_row['description']. '<br />'.number_format( $get_row['price'], 2) . '<a href="cart.php?add='. $get_row['id'].'">Add</a></p>'; } } } echo $_SESSION['cart_1']; ?> I am getting this error message: Notice: Undefined variable: folders in /hsphere/local/home/digitaldaylight/herorisingthebook.com/modules/mod_nivoslider/tmpl/default.php on line 15 The code on line 15 is: modNivoSliderHelper::render($params, $folders, $images); ?> How do I redo the code to get rid of the error message. Essentially I tried if code and isset but I am not knowledgible enough in php to fix the problem. And I dont want to change the reporting error sensitivity. Its best to do a fix of the code rather than ignore it. |