Jump to content

Palle Villesen I need your help please


oavs

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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