SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Notice: Undefined index: parse_var in

    I’m a newbie, me gentle on me.

    I never had this error until my web hosting company upgraded PHP from
    PHP 5.2.x to PHP 5.3.x.

    My edit profile page is giving me this following error…

    Notice: Undefined index: parse_var in /home/*****/public_html/edit_profile.php on line 152 & line 172

    Line 152...
    if ($_POST['parse_var'] == "links"){

    $website = $_POST['website'];
    $website = strip_tags($website);
    $website = str_replace("http://", "", $website);
    $website = str_replace("'", "'", $website);
    $website = str_replace("`", "'", $website);
    $website = mysql_real_escape_string($website);
    $youtube = preg_replace('#[^A-Za-z_0-9]#i', '', $_POST['youtube']); // filter everything but desired characters
    $sqlUpdate = mysql_query("UPDATE myMembers SET website='$website', youtube='$youtube' WHERE id='$id' LIMIT 1");
    if ($sqlUpdate){
    $success_msg = '<img src="images/round_success.png" width="20" height="20" alt="Success" />Your links and API connections have been updated successfully.';
    } else {
    $error_msg = '<img src="images/round_error.png" width="20" height="20" alt="Failure" /> ERROR: Problems arose during the information exchange, please try again later.</font>';
    }
    }


    Line 172...
    if ($_POST['parse_var'] == "bio"){

    $bio_body = $_POST['bio_body'];
    $bio_body = str_replace("'", "&#39;", $bio_body);
    $bio_body = str_replace("`", "&#39;", $bio_body);
    $bio_body = mysql_real_escape_string($bio_body);
    $bio_body = nl2br(htmlspecialchars($bio_body));
    // Update the database data now here for all fields posted in the form
    $sqlUpdate = mysql_query("UPDATE myMembers SET bio_body='$bio_body' WHERE id='$id' LIMIT 1");
    if ($sqlUpdate){
    $success_msg = '<img src="../root/images/round_success.png" width="20" height="20" alt="Success" />Your description information has been updated successfully.';
    } else {
    $error_msg = '<img src="../root/images/round_error.png" width="20" height="20" alt="Failure" /> ERROR: Problems arose during the information exchange, please try again later.</font>';
    }
    }


    Thanks in advance,
    Scotty13

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Hi Scotty13,

    is the parse_var being sent from the form?
    What does the html look like for your forms output?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It comes from this table

    <table width="90%" border="0" align="center">
    <form action="root/edit_res.php" enctype="multipart/form-data" method="post" name="bioForm" id="bioForm">
    <tr>
    <td width="12%"><strong>Over the years, I've been...</strong>/td>



    <td width="54%"><textarea name="bio_body" cols="" rows="5" class="formFields" style="width:94%;"><?php echo "$bio_body"; ?></textarea></td>
    <td width="34%">
    <input name="parse_var" type="hidden" value="bio_body" />
    <input type="submit" name="button10" id="button10" value="Submit" /></td>
    </tr>
    </form>
    </table>

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Location
    The Netherlands
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP doesn't know the var $_POST['parse_var'] because it doesn't exist when your form doesn't get submitted.

    If you do
    PHP Code:
     ini_set('error_reporting',E_NONE); 
    it will be gone. Or look in php.net to find other values you can assign to error_reporting.
    You can also do something like
    PHP Code:
    if(!isset($_POST['parse_var'])) $_POST['parse_var'] = ''

  5. #5
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you!!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •