473,394 Members | 1,841 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,394 software developers and data experts.

carrying over string value to other pages

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 'glossarytemplate.php'. 'glossarytemplate.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="glossarytemplate.php">augmented</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 glossarytemplate.php page, thus:


<?php

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

if ($entry == $augmented) {include ("glossarydata/augmented.html");}
elseif ($entry == $tritone) {include ("glossarydata/tritone.html");}
elseif ($entry == $kurchatov) {include ("glossarydata/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 ("glossarydata/the name of the file that's in the $entry string.html");}


Thanks a lot,

fructose
Sep 23 '06 #1
3 1335
ronverdonk
4,258 Expert 4TB
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="glossarytemplate.php">augmented</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
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 glossarytemplate, 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 glossarytemplate. 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 Expert 4TB
How about setting the $augmented value dynamically in the link href with parm value? like this
[PHP]
<?php
echo "<a href='glossarytemplate.php?value=$augmented'>augme nted</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
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...
36
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. ...
3
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...
32
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...
1
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...
5
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...
3
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...
1
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
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,...
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...
0
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...

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.