Jump to content

need help to solve problem ...


panyaung

Recommended Posts

Hi all,

 

I am facing a problem and I hope you can help and give suggestions.

I have an application written in php which use mysql for database. The application is running properly in the current server. I also have a backup server and I need to back up the applications on it, later I may use this backup server for my applications. My problem is:

When I copy the applications and database to the backup server, some of the pages are not working in backup server, whereas they run in the current web server. I’ve got the same error messages for all pages which are not working. The error message is

“PHP Notice: Undefined index: xxx in xxx\...\xxx.php on line no.”

 

When I look at those lines, I found out that the error shows in $_POST[‘variable’] or $_REQUEST[‘variable’].

 

I am out of my idea to solve this problem because the exactly the same coding is working in current server. Please give me suggestions to solve the problem. Thanks in advance you guys!

 

*******

Panyaung:confused:

Link to comment
https://forums.phpfreaks.com/topic/175467-need-help-to-solve-problem/
Share on other sites

It all comes down to bad coding. By looks of it, your trying to set a variable from the POST array when nothing has been posted. That's why most people use something like:

 

if(isset($_POST['posted_value'])){
//set posted values
}

Thanks for your help ProjectFear but I wonder why that coding is working in the current web server and not working in backup server?

I am not familiar with php and so help me more.

The following is the code which includes $_POST:

********

if (count($OC_extar) == 1) {        # Only accept one format?

    print $OC_formatAR[$OC_extar[0]] . ' only <input type="hidden" name="format" value="' . $OC_extar[0] . '"><p />';

} else {

print '<select name="format">';

$formatoptions = "";

foreach ($OC_extar as $fval) {

$formatoptions .= '<option value="'.$fval.'"> '.$OC_formatAR[$fval];

}

$fid=$_POST['format'];    <=line number in error msg

print $formatoptions;

print "</select><p />\n";

}

******

It could be that the error reporting on the current server is set to not show error messages.

On the current server, put this at the top of the page:

 

error_reporting(E_ALL);

 

That should display the notice on the current server as well.

Archived

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

×
×
  • 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.