Jump to content

Archived

This topic is now archived and is closed to further replies.

abitlikehomer

Undefined index error: Trying to pass variable to another page

Recommended Posts

Huh.... I didn't actually notice you already had a random number appended to the url.

 

Not sure where to go from here really. The code in question could not possibly produce the output firebug is saying.

No me neither lol, not that that counts for much. It is obviously picking up the old code from somewhere but they are completely separate files with different links so I have no idea why it is doing this.

 

Thank you for all your help anyway though :)

Share this post


Link to post
Share on other sites
It is obviously picking up the old code from somewhere but they are completely separate files with different links so I have no idea why it is doing this.

 

So are you sure you requesting the correct file?

Share this post


Link to post
Share on other sites

FOUND IT!!! Look in the selectNewsTest.js page. The variable to pass the URL - it is still set to the old link selectNews.js.

 

I have changed it now and it is almost working. It throws up one error message though:

Notice: Undefined index: NewsID in /customers/2asmooth.com/2asmooth.com/httpd.www/Kingfisher_Trust/getNewsTest.php on line 9

Share this post


Link to post
Share on other sites

It is obviously picking up the old code from somewhere but they are completely separate files with different links so I have no idea why it is doing this.

 

So are you sure you requesting the correct file?

I wasn't doing - but I noticed it at about the same time as you must have done.

Share this post


Link to post
Share on other sites

The undefined index is easy fixed.

 

<?php
include "connection.php";
if (isset($_GET['NewsID'])) {
  $NewsID = mysql_real_escape_string($_GET['NewsID']);
  $query = "SELECT Title, `Date`, Content FROM News WHERE NewsID = $NewsID LIMIT 1"; 
  if ($result = mysql_query($query)) { 
    if (mysql_num_rows($result)) {
      $row = mysql_fetch_array($result); 
      echo $NewsID . '||' . htmlentities($row['Title']) . '||' . htmlentities($row['Date']) . '||' . htmlentities($row['Content']);
    }
  }
}
?>

Share this post


Link to post
Share on other sites

Sorry, but I have never seen any code that points to editReciept.php

Share this post


Link to post
Share on other sites

Sorry, but I have never seen any code that points to editReciept.php

Sorry - that is part of the code when the second form is called. However I have corrected the mistake now and everything works!

 

Thorpe I cannot thank you enough for all the help and support you've given me the last couple of days - you're a life saver. If your in the UK and ever up north I owe you many a pint!! Thanks :D

 

I can finally mark this as closed! YAY!!!!!!!!!

Share this post


Link to post
Share on other sites

Sweet, I didn't think we where ever going to get there! :) Glad its all working now.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.