Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 31st, 2007, 08:56 AM
Registered User
 
Join Date: Oct 2007
Location: , , Philippines.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to p3allen2000
Default undefined index and variable

Hey guys...am having problems with updating with php5. Now am having undefined index and varibles on most of the pages of the website that i am working on. How can i do away with them? this is my code:



<?php

        require_once("connection.php");



        $recno=$_POST['recno'];




         echo "recno=$recno";


        $cdest="";
        $id="";
    for($saverec=1; $saverec<$recno; $saverec++)
    {


        $ccont="reccont".$saverec;
        $ccont = $_POST["$ccont"];

        $ccode="reccode".$saverec;
        $ccode=$_POST["$ccode"];

    $ccat="reccat".$saverec;
        $ccat=$_POST["$ccat"];

    $cprice="recprice".$saverec;
        $cprice=$_POST["$cprice"];

    $cRFC="recRFC".$saverec;
        $cRFC=$_POST["$cRFC"];

    $cdim="recdim".$saverec;
        $cdim=$_POST["$cdim"];

    $cclass="recclass".$saverec;
        $cclass=$_POST["$cclass"];

    $ccman="reccman".$saverec;
        $ccman=$_POST["$ccman"];

        $recfile="recfile".$saverec;
        $recfile=$_POST["$recfile"];

        $chidid="rechidid".$saverec;
        $chidid=$_POST["$chidid"];

        $crec="recfile".$saverec;
        $crec=$_POST["$crec"];



echo "<br>id=$chidid, reccont=$ccont, ccode=$ccode, category=$ccat, RFC=$cRFC, dimension=$cdim, class=$cclass, cman=$ccman, price=$cprice<br><br>";


        $dest = basename($_FILES["$crec"]['name']);



$qupdate = "UPDATE tblfurniture_back
            SET contno='$ccont', prodcode='$ccode', category='$ccat', RFC='$cRFC',dimension='$cdim', class='$cclass', cman='$ccman',price='$cprice', dest='$cdest' where id='$id'";



       if(mysql_query($qupdate))
        {
         echo "<br><center>Record Update Successful!</center><br>";

        }

        else
        die (" Data Update Failed!".mysql_error());


        move_uploaded_file($_FILES["$crec"]['tmp_name'], $dest);



}

    mysql_close();

echo "<center><a href=apanelnext_back.php>back</a></center>";


?>


Reply With Quote
  #2 (permalink)  
Old November 1st, 2007, 04:49 PM
Authorized User
 
Join Date: Sep 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Default

Which variable is giving you that error ($recno)?

You need to make sure that there is a value in the $_POST array like so:

Code:
if(isset($_POST["recno"])){ $recno = $_POST["recno"]; } else { $recno = ""; }
And a shortcut of writing the above would be like
Code:
$recno = (isset($_POST["recno"])) ? $_POST["recno"] : "";
And there is another option...for the server configuration(php.ini) you could lower the error reporting

http://mynameissteve.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Notice: Undefined index: username in latinquarter PHP Databases 1 April 18th, 2008 11:37 AM
Undefined index junemo Pro PHP 8 October 31st, 2007 05:45 PM
upload files - Undefined index: DOCUMENT_ROOT lanita PHP How-To 4 July 14th, 2006 09:07 AM
Undefined Index Error rit01 Beginning PHP 0 March 1st, 2006 10:03 AM
Undefined index ashinotani Beginning PHP 2 August 17th, 2004 03:31 PM



All times are GMT -4. The time now is 10:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.