Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 7th, 2007, 03:57 PM
Authorized User
 
Join Date: Aug 2003
Location: Schuylerville, NY, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default link to anchor in a db-generated page

I have monthly and non-monthly programs loaded into a table, field=moprog, that link to an anchor on another page that is db-generated.

Page 1 code:
Code:
if($data['moprog'] == 'Yes') echo "<p><a href=\"./programs.php#".$data['month']."\" class=\"subheadb\" style=\"margin-bottom: 10px;\">".$data['month']." Program</a></p>";
Page 2 code:
Code:
echo "<a name=\"".$data['month']."\"></a><h1>".$data['month']." Breakfast Program</h1>
***It will load the db-generated page but won't focus on the anchor.***

Please let me know if I need to further explain my situation. Any help would be greatly appreciated.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HollyAnn
aka Scottiegirl

"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die." - Calvin, Calvin and Hobbs
__________________
HollyAnn
aka Scottiegirl

\"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die.\" - Calvin, Calvin and Hobbs
Reply With Quote
  #2 (permalink)  
Old December 7th, 2007, 05:46 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi HollyAnn,

It seems that you have two "pages" of code to handle this... I can't tell from your post whether or not both "pages" are generated from program.php. If so, the user's web browser will not make a new request to the server, but will look for the anchor on the current page.

Therefore, you'll need to make sure that either:

1) page 1 and page 2 are physically different files, or
2) page 2's content gets generated as part of page 1's output (all in program.php).



Does that make sense?

HTH,
Nik
Reply With Quote
  #3 (permalink)  
Old December 7th, 2007, 07:38 PM
Authorized User
 
Join Date: Aug 2003
Location: Schuylerville, NY, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nik,

You are correct; there ARE 2 pages to handle this. They are both calling from the same table, but page 2, content is NOT generated from page 1's output.

Hmmm.... I really needed something to eat so I went out to dinner and had a couple of drinks, ergo my reasoning and programming skills are kaput.....

Would you help me reprogram page 2? Let me know if you'd like to continue this post via email so that I could give you further coding...

Thanks for "coming back" just for me .......
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



HollyAnn
aka Scottiegirl

"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die." - Calvin, Calvin and Hobbs
Reply With Quote
  #4 (permalink)  
Old March 11th, 2008, 12:43 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: South San Francisco, CA, USA.
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try this:

Page 1 code:


if($data['moprog'] == 'Yes')
{
  // echo "<p><a href=\"./programs.php#".$data['month']."\" class=\"subheadb\" style=\"margin-bottom: 10px;\">".$data['month']." Program</a></p>";

  echo '<p>';
  echo '<a href="./programs.php#'.$data['month'].'" class="subheadb" style="{margin-bottom: 10px;}">';
  echo $data['month'] .' Program</a>';
  echo '</p>';
}



Page 2 code:

  // echo "<a name=\"".$data['month']."\"></a><h1>".$data['month']." Breakfast Program</h1>

  echo '<a name="'.$data['month'].'" />';
  echo '<h1>'.$data['month'].' Breakfast Program</h1>';



Reply With Quote
  #5 (permalink)  
Old March 11th, 2008, 12:19 PM
Authorized User
 
Join Date: Aug 2003
Location: Schuylerville, NY, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

And the Hallelujah Chorus rings throughout the heavens! Thank you, jmaronilla! It Works!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HollyAnn
aka Scottiegirl

"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die." - Calvin, Calvin and Hobbs
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
anchor link not working in IE6 sbkumar CSS Cascading Style Sheets 2 July 29th, 2008 11:27 AM
Export from Access to Excel in ASP generated page u0107 Classic ASP Basics 1 July 16th, 2006 05:25 AM
Multiple-step OLE DB operation generated errors. rameshkumarm SQL Server DTS 1 August 28th, 2004 09:28 AM
making a db field link on a page doranaz Classic ASP Databases 0 December 19th, 2003 01:13 PM
Help with paginating and anchor link. major dynamic123 Pro PHP 6 September 11th, 2003 01:47 PM



All times are GMT -4. The time now is 11:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.