Jump to content


Photo

Palle Villesen I need your help please


  • Please log in to reply
1 reply to this topic

#1 oavs

oavs
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts
  • LocationDownunder

Posted 23 June 2003 - 06:05 AM

Hello Palle,

You obviously know the answer to my problem. I can not get any other answer as close as yours.

I am a newbie. In my previous post you answered me but I still need further help please.

Why am I getting a blank page?

<?php // at the top of mdbedit.php session_start(); // restore session $username = $_SESSION[\'username\']; // THE ABOVE WILL RESTORE THE SESSION, AND PUT THE CONTENT OF THE SESSION VARIABLE USERNAME into the variable $username. <?php require_once(\'../Connections/connMDB.php\'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "\'" . $theValue . "\'" : "NULL";      break;        case "long":    case "int":      $theValue = ($theValue != "") ? intval($theValue) : "NULL";      break;    case "double":      $theValue = ($theValue != "") ? "\'" . doubleval($theValue) . "\'" : "NULL";      break;    case "date":      $theValue = ($theValue != "") ? "\'" . $theValue . "\'" : "NULL";      break;    case "defined":      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;      break;  }  return $theValue;}$editFormAction = $HTTP_SERVER_VARS[\'PHP_SELF\'];if (isset($HTTP_SERVER_VARS[\'QUERY_STRING\'])) {  $editFormAction .= "?" . $HTTP_SERVER_VARS[\'QUERY_STRING\'];}if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "updateForm")) {  $updateSQL = sprintf("UPDATE mdbTable SET AlbumCatalogNumber=%s, AlbumArtist=%s, AlbumName=%s, Genre=%s, AlbumLabel=%s, AlbumYearReleased=%s, Type=%s, AlbumTracks=%s, AlbumCountry=%s, AlbumCondition=%s, AlbumPrice=%s, AlbumNotes=%s, AlbumQty=%s, AlbumCoverURL=%s, AlbumCoverThumbnailURL=%s WHERE AlbumID=%s",                       GetSQLValueString($HTTP_POST_VARS[\'AlbumCatalogNumber\'], "text"),etc etc . rest of the code


#2 pallevillesen

pallevillesen
  • Members
  • PipPipPip
  • Advanced Member
  • 135 posts
  • LocationDenmark

Posted 23 June 2003 - 07:26 AM

Hi,

I just took the top lines from your posted code... So what I wrote was an extract of the page (mdbedit.php ?) with a few lines added....

Anyway, if your phpserver is having the global variables option turned OFF, which is most likely )you may check it with a page, haing content
<?php phpinfo();?>

It will be under register_globals in the section \'php core\'... Anyway: you should always code like they are turned off (safer code!)

That means that ANY variable you are going to pass from one page to another must be FETCHED on the resultpage (page2) where the submitting page is normally page 1.... (or index.php refers to edit_record.php or something similar)....

That means you may pass variables in three ways:

POST (using a form)
GET (using a form or putting it in the URL, like www.palle.dk/test.php?ID=10, will pass the variable ID with the value of 10 to the page called test.php)
session variables (plenty of tutorials).

The IMPORTANT THING IS TO FETCH THE VARIABLES AGAIN!!! They are passed to the page, but the page still have to read them! This is a truth with some modifications, but they are passed as special variables like this:

$_POST[\'ID\']
$_GET[\'ID\']
$_SESSION[\"ID\']

This was the variable ID being passed, so normally I would put a line in the top like this:
$ID = $_SESSION[\'ID\'];

otherwise I would have to use $_SESSION.... in all the rest of the code, now I just use $ID...

Anyway you missing variables are being passed to the function (a function I don\'t know what does), so they should probably not be empty!

I\'m leaving for a conference later today and I\'m quite busy finishing presentations etc. so I hope some other people have some time to check this and help oavs. ?

Have fun,
P.
Palle Villesen, www.birc.dk [br]Bioinformatics Research Center




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users