473,804 Members | 3,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

carrying over string value to other pages

8 New Member
Thanks for help on my first post about the glossary entries guys. I've run into a bigger problem on the same topic though. (Forget anything I said in the last post, this is a separate point).

OK, here's the deal: I've got a page with hundreds of technical terms on it, and I want each term to link to a glossary

entry on a separate page.

That would be simple, except I want the printed data of each glossary entry to be a small file which will be accessed by a

'php include' from a template page called 'glossarytempla te.php'. 'glossarytempla te.php' has loads of other includes for

menus, java scripts, changeable graphics, roll-over messages etc, so to make a perfectly formatted page for each glossary

entry with all the necessary includes would be dangerous, as changing my mind about any presentation or structure would

result in a nightmarish update process.

Here's an example of my code from the page containing the article with all the technical terms:


<a <?php $entry == $augmented; ?> href="glossaryt emplate.php">au gmented</a>


My theory was that clicking on the word 'augmented' would assign equate $augmented with the string $entry, and that I

would use $entry on the glossarytemplat e.php page, thus:


<?php

$no_data = "<p>This definition is coming soon. Please check back later.</p>";

if ($entry == $augmented) {include ("glossaryda ta/augmented.html" );}
elseif ($entry == $tritone) {include ("glossaryda ta/tritone.html"); }
elseif ($entry == $kurchatov) {include ("glossaryda ta/kurchatov.html" );}
else
{echo $no_data;}

?>


It seems, however, that the value of $entry won't be carried over to another page. Any solutions?

A bigger problem (and one which may render all the above void), is that my 'elseif''s will run into the hundreds using this method. Is there a command for rendering something equivalent to the following plain-English?


{include ("glossaryda ta/the name of the file that's in the $entry string.html");}


Thanks a lot,

fructose
Sep 23 '06 #1
3 1349
ronverdonk
4,258 Recognized Expert Specialist
Your <a > tag assignment is wrong, you use the logical compare operator (==)instead of the assignment operator )=). That statement should be
[PHP]<a <?php $entry = $augmented; ?> href="glossaryt emplate.php">au gmented</a>
[/PHP]
However, the variable $entry is always set, whether you click or not.
If you want it to be set when clicked, you'd better use JavaScript with an onClick() function.

Ronald :cool:
Sep 23 '06 #2
fructose
8 New Member
Thanks Ronals,

All points duly noted. :-)

I need to avoid javascript for sensing the click for accessibility reasons though.

Can you point me in the right direction regarding any other approach? Perhaps I could direct each click to its own page, rather than to the glossarytemplat e, but then each of these pages would be a mere include to the template, then, using PHP, I could ask what the filename was of the page that directed to the glossarytemplat e. The filename data would allow me to call the appropriate file with the definition.

Would that work?

Cheers,

fructose
Sep 23 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
How about setting the $augmented value dynamically in the link href with parm value? like this
[PHP]
<?php
echo "<a href='glossaryt emplate.php?val ue=$augmented'> augmented</a>";
?>[/PHP]
In your receiving script you would have to interrogate the $_GET array, as follows (without parameter cleansing, you'll do that yourself):
[PHP]
<?php
$if (isset($_GET['value'])
$augmented = $_GET['value'];
else
// whatever you want to do when value is not set
?>
[/PHP]

Ronald :cool:
Sep 23 '06 #4

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

Similar topics

3
6275
by: Ralph Freshour | last post by:
I was reading about PHP variable scoping - it doesn't seem to support carrying any variables from one web page to another - how is this usually done? I have a lot of php variables created on my home page that I need to make use of on other web pages - how can I do that? Thanks...
36
10127
by: Richard | last post by:
My employer currently pays me $1/hour when I carry a pager. I have to carry the pager every fourth week. The problem is that my employer insists that I be available when I'm carrying the pager. So, for $1/hr they expect me to remain within pager range, remain sober, and be available to come to work. That really sucks on weekends. No going to the beach (out of pager range) or out to a friend's cottage (out of pager range), etc. ...
3
1488
by: Ray | last post by:
I'm sorry this is a long post but I though I had better include everything as I'm new to VB. I have a a form frmCalendarMain which has five subforms (unbound). Each form is a reservation calendar frmCalendarRm1, frmCalendarRm2....Rm5 etc. At the moment if I click on a field which is already booked then I can open the reservation form (frmGuests) by calling (GetContract). This workes fine, however I would like the user to be able to...
32
14917
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
1
2092
by: Ani | last post by:
Hi, I need to carry the user input across pages and then at the end insert all the values into the DB. How do I best accomplish this task in ASP.Net. I am a novice , please give me some simple suggestions. Thanks.
5
2797
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
3
1089
by: tshad | last post by:
I have a User object that has all the information on the object (firstName, LastName, email, userName, password, address, gender, dob etc). I want to only carry in a session variable the logon information (firstName, LastName, email, userName, password). Is it best to just carry all the information or create a different object with just a subset of the information? I am concerned with efficiency and speed here. If I am carrying a...
1
5068
devonknows
by: devonknows | last post by:
Hi, im having trouble carrying variables across a form, ive looked on here and other sites but cant find anything that helps me, or i might not be searching for the right terms, so i though i would post to see if anyone can help me. what i need is to carry certain aspects of data from splash form to my main form which im currently developing. this is the code im usign for the frmSplash Option Explicit Private Declare Function...
4
14109
by: Kurrent | last post by:
I have some data from text fields that are being passed over through a form that I am displaying with the $_POST superglobal. Once i have echo'd out this data onto the next page, i'd like to continue to use it on the next page. I haven't figured out how to do this properly just yet, but I'm guessing it has something to do with sessions. I have MANY variables being passed (over 100) and I'm hoping i don't have to register each one of these...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.