Jump to content

Recommended Posts

Hello,

 

I've been working on this for days and read everything I can and can't get this resolved so I figured it was time to pull into the gas station and get directions.

 

I've got 2 databases that I'm working with and 3 forms.  One form is just the login where I've set a session variable of the username.  Once logged in the user goes to a news upload form.  The other form is the registration form where I keep all the info on their organization.

 

I'm wanting to use dynamic text to pre-fill some of the fields in the news upload form so they can confirm that the info is correct and if not allow them to update it in that form but I can't get the dynamic text to echo in the form fields.

 

Here's the code for the SESSION in the login page that I'm using:

//declare two session variables and assign them

    $_SESSION['MM_Username'] = $loginUsername;

    $_SESSION['MM_UserGroup'] = $loginStrGroup;

 

And here's the recordset code in the news upload page:

$colname_rs_nfupload_formfill = "-1";

if (isset($_SESSION['MM_Username'])) {

  $colname_rs_nfupload_formfill = $_SESSION['MM_Username'];

}

mysql_select_db($database_tracks, $tracks);

$query_rs_nfupload_formfill = sprintf("SELECT trkname, trkusername, trkstate, orgtrack, orgsanction, orgprmarketing, orgmedia, firstname, lastname, contactphone, contactemail, trkwebsite FROM tracklist WHERE trkusername = %s", GetSQLValueString($colname_rs_nfupload_formfill, "text"));

$rs_nfupload_formfill = mysql_query($query_rs_nfupload_formfill, $tracks) or die(mysql_error());

$row_rs_nfupload_formfill = mysql_fetch_assoc($rs_nfupload_formfill);

$totalRows_rs_nfupload_formfill = mysql_num_rows($rs_nfupload_formfill);

 

if (!isset($_SESSION)) session_start(); ?>

 

I am trying to pull the data from one database for the dynamic text but the "Insert Record" behavior sends the data to another database.  Could this be a problem?

 

Everything seems to work OK with the exception that the dynamic data doesn't appear.  I can look in cookies and there is a session id set, the login page forwards to the news upload page and the data that is input in both the registration form and the newsupload form does insert into the database.

 

Any ideas here?  Please be gentle on the explanations as this is only my 4th website design and my first dynamic site so I'm new to all of this.

 

Thanks in advance.

I have the feeling you've not started the session before trying to access session data, though the code I'm not sure if that's in order or what. If it's not already, move "session_start()" to the start of your code and see if that fixes the problem.

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.