Notice: Undefined index:

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • selvialagar
    New Member
    • Apr 2008
    • 57

    Notice: Undefined index:

    When i want to save the page,the notice apperas as undefined index...plz solve the pbm here is the coding

    this is at the very first line in my page
    [code=php]
    if(isset($_GET['save']) && $_GET['save']=="yes" && isset($_GET['cid']))
    {
    $cust_id=$_GET['cid'];
    $edit_cname=$_P OST['edit_cname'];
    $edit_caddr=$_P OST['edit_caddr'];
    $edit_cphno1=$_ POST['edit_cphno1'];
    $edit_cphno2=$_ POST['edit_cphno2'];
    $edit_cemail=$_ POST['edit_cemail'];
    $edit_web=$_POS T['edit_cweb'];
    if(is_numeric($ edit_cphno1) && is_numeric($edi t_cphno2))
    {
    @$up=mysql_quer y("update pms_customer set cust_name='$edi t_cname',cust_a ddr='$edit_cadd r',cust_ph=$edi t_cphno1,cust_p h1=$edit_cphno2 ,email='$edit_c email',website= '$edit_web' where cust_id=$cust_i d") or die('Unable to perform operation');
    header("locatio n:cust_index.ph p?action1=dis&c id=$cust_id");
    }
    }



    <body bgcolor="#dbdbd b">
    <?php

    if(isset($_GET['action1']) && $_GET['action1']=="dis")
    {
    include('adminl ogin.php');

    $query=mysql_qu ery("select cust_name,cust_ id from pms_customer");
    ?>
    <form action="" method="post" name="cust">
    <br />
    <center>
    Select Customer Name :
    <select name="cname" id="cname" onChange="cust_ display()">
    <option value="0">--Select--</option>
    <?php

    while($r=mysql_ fetch_object($q uery))
    {
    if(isset($_GET['cid']))
    {
    $cid=$_GET['cid'];
    if($cid==$r->cust_id)
    {
    ?>
    <option value="<?php echo $r->cust_id;?>" selected="selec ted"><?php echo $r->cust_name;?> </option>
    <?php
    }
    else
    {
    ?>
    <option value="<?php echo $r->cust_id;?>"><? php echo $r->cust_name;?> </option>
    <?php
    }
    }
    else
    {
    ?>
    <option value="<?php echo $r->cust_id;?>"><? php echo $r->cust_name;?> </option>
    <?php
    }
    }
    ?>
    </select>

    <?php
    if(isset($_GET['cid']))
    {
    $cust_id=$_GET['cid'];
    $query=mysql_qu ery("select * from pms_customer where cust_id=$cust_i d");
    $res=mysql_fetc h_object($query );
    ?>
    &nbsp;&nbsp;&nb sp;&nbsp;[<a href="cust_inde x.php?action=de l">Delete</a>]
    <br /><br />
    <fieldset>
    <legend>Custome r Details</legend>
    <table align="center" cellspacing="9" >
    <tr><td>Custome r Name </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <input type="text" name="edit_cnam e" value="<?php echo $res->cust_name;?> " />
    <?php
    }
    else
    {
    echo $res->cust_name;
    }
    ?></td></tr>
    <tr><td>Addre ss </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <textarea cols="25" rows="3" name="edit_cadd r"><?php echo $res->cust_addr;?> </textarea>
    <?php
    }
    else
    {
    echo $res->cust_addr;
    }
    ?>
    </td></tr>
    <tr><td>Phone Number1 </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <input type="text" name="edit_cphn o1" value=<?php echo $res->cust_ph;?> />
    <?php
    }
    else
    {
    echo $res->cust_ph;
    }
    ?>
    </td></tr>
    <tr><td>Phone Number2 </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <input type="text" name="edit_cphn o2" value="<?php echo $res->cust_ph1;?>" />
    <?php
    }
    else
    {
    echo $res->cust_ph1;
    }
    ?>
    </td></tr>
    <tr><td>Email - ID </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <input type="text" name="edit_cema il" value="<?php echo $res->email;?>" />
    <?php
    }
    else
    {
    echo $res->email;
    }
    ?>
    </td></tr>
    <tr><td>Web Site </td><td>:</td><td>
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    <input type="text" name="edit_cweb " value="<?php echo $res->website;?>" />
    <?php
    }
    else
    {
    echo $res->website;
    }
    ?>
    </td></tr>
    <tr><td colspan="3" align="center">
    <?php
    if(isset($_GET['action']) && $_GET['action']=="edit_cust" )
    {
    ?>
    [<a href="cust_inde x.php?save=yes& cid=<?php echo $cust_id;?>">Sa ve</a>] &nbsp;&nbsp;&nb sp;[<a href="cust_inde x.php?action1=d is&cid=<?php echo $cust_id;?>">Ca ncel</a>]
    <?php
    }
    else
    {
    ?>
    <tr><td colspan="3" align="center">[<a href="cust_inde x.php?action=ed it_cust&action1 =dis&cid=<?php echo $cust_id;?>">Ed it Section</a>]
    <?php
    }
    ?>
    </td></tr>
    </table>
    [/code]
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Please post your error message, Sorry little bit busy here. Can't read your code from top to bottom. your error message will say exactly what's missing there.

    Comment

    • selvialagar
      New Member
      • Apr 2008
      • 57

      #3
      hai
      here is the error messages...plz help me....
      Notice: Undefined index: edit_cname in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 9

      Notice: Undefined index: edit_caddr in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 10

      Notice: Undefined index: edit_cphno1 in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 11

      Notice: Undefined index: edit_cphno2 in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 12

      Notice: Undefined index: edit_cemail in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 13

      Notice: Undefined index: edit_cweb in /rhome/mainlab/user/selvi/Desktop/pms/cust_index.php on line 14

      Comment

      • TheServant
        Recognized Expert Top Contributor
        • Feb 2008
        • 1168

        #4
        You have half your form from POST variables and half from GET variables. Your submission can only be one of the two. If you don't understand the difference, please look it up on google and then come back here with any more problems.

        Comment

        Working...