473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing Record ID Problem

40
Hi again all,

Quick php/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!
Sep 25 '07 #1
4 1938
brettl
41
Not sure what you're trying to do, but see if this helps.

Expand|Select|Wrap|Line Numbers
  1. $insertGoTo = "show_inventory.php?recordID=".$row_rs_add_inventory['id'];
  2.  
Sep 25 '07 #2
vozzek
40
Ah, I should probably smack myself in the forehead for not trying concatenation. Thanks!

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). 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...

Still confused.
Sep 25 '07 #3
brettl
41
$insertGoTo = "show_inventory.php"
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
Did you close the open { in your if?
Sep 25 '07 #4
vozzek
40
Yes, sorry - that's the next line. I closed the if.
Sep 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phillip Wu | last post by:
Hi, I saw a previous post about sending arrays but did not quite understand the answers. The problem is that I would like to pass an entire array as a hidden input field from one php script...
3
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
3
by: Fredrik/Sweden | last post by:
Hi folks ! got this problem... i have a table 'Accounts' in my database, which contains a bunch of users. From the main menu i choose "edit user" and all users in the db are presented in a table....
5
by: kazack | last post by:
I am a little confused with code I am looking at. My c++ book does not go into passing a structure to a function so I pulled out a c book which does. and I do not understand the prototype verses...
7
by: Henry Combrinck | last post by:
Hello Hopefully someone can shed some light on the following issue. After chatting at irc.freenode.net/#postgresql, without success, this is my last effort before giving up and using a temp...
28
by: Skeets | last post by:
i'm passing session and hidden variables between pages. not to mention post values. i'm a little concerned that someone with sufficient knowledge could spoof these vlaues and manipulate the...
10
by: Tracy | last post by:
Dear all, I have encountered a problem in passing a VARCHAR parameter (which is a list of accepted values) to the IN predicate of a DB2 user-defined function. For example, I have a table...
5
by: Swinky | last post by:
I have a form "AccountInfo" that contains company names. I have inserted a subform "Contacts" with contact names and have established parent/child relationships between the two forms. All works...
1
by: CriminalTruth | last post by:
"Hi i created an access 2003 dmb that tracts inventory by a production number. Now i need a way to decrease the inventory as it gets removed from inventory which a clerk would input. i know the...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.