Jump to content

Passing Record ID Problem w/Dreamweaver


vozzek

Recommended Posts

Hi again all,

 

Quick Dreamweaver problem:  I've got an add_inventory.php page that populates my database keyed off of 'id'.  When I built the record insertion form it asked for a destination, which I put in as show_inventory.php.  I built this page later on, to show certain fields the user just entered.

 

Added a recordset to the add page (rs_add_inventory), only choosing the 'id' field.  I need to pass that parameter to the show page, so it can display all the fields.  So going into the code, I saw Dreamweaver had written the following lines of code:

 

$insertGoTo = "show_inventory.php"

if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

 

I modified the top line of code to read as follows, thinking it would pass the parameter:

 

$insertGoTo = "show_inventory.php?recordID=<?php echo $row_rs_add_inventory['id']; ?>";

 

Can anyone see what I did wrong?  I'm getting a Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

 

I'm kinda new at this, so any help would be appreciated.

Thanks in advance!

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/70648-passing-record-id-problem-wdreamweaver/
Share on other sites

Ah, I should probably smack myself in the forehead for not trying concatenation. Thanks!  Someone else just pointed this out to me also.

 

However, it still doesn't pass the 'id' value. I think your syntax is 100% correct but unfortunately since this is the posting form, the 'id' value hasn't actually been defined yet (at the time) if that makes any sense. It's a self-incrementing element of the database, so I guess maybe it happens after the posting? I think I'm trying to do the database call before the element is populated... dunno.

 

Still confused.

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.