Current location: Hot Scripts Forums » Programming Languages » PHP » Two questions (in one thread, what a deal!)


Two questions (in one thread, what a deal!)

Reply
  #1 (permalink)  
Old 09-24-03, 03:32 PM
G M Morris G M Morris is offline
New Member
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Two questions (in one thread, what a deal!)

Hi,

1)I need a script, prefferably in JavaScript, which will let me have two lists on one HTML page, have two buttons and have one button move a selected item from list A into list B, and the second button do the opposite, movean item from list B to list A.

And all this must be done without the page refreshing.

2)Is there a way, in PHP, for me to force the browser to add a variable to the url (GET) of every link without having to actually add the text "?sid=345j34k2kn3kmn4" to every link?


Any help will be appretiated, tnx in advance

Gidi
Reply With Quote
  #2 (permalink)  
Old 09-24-03, 07:39 PM
Patriarch Patriarch is offline
Newbie Coder
 
Join Date: Sep 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
GM Morris:

I can't help you for your first question, unfortunately my knowledge in JavaScript is a bit lacking.

However, for your second question, you may use the superglobal $_SERVER['QUERY_STRING'] to append the query string to any hyperlinks you need. i.e.:

PHP Code:

<a href="index.php?<?= $_SERVER['QUERY_STRING']; ?>">Click here!</a>
Reply With Quote
  #3 (permalink)  
Old 09-25-03, 11:47 AM
G M Morris G M Morris is offline
New Member
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
two things (again)-

1) Call me Gidi

2) I'm looking for something that'll do it automaticaly, not by me adding the PHP code to all links on the page.
Reply With Quote
  #4 (permalink)  
Old 09-28-03, 05:35 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Just for the urls in the page, replace index.php with $url and then at the beggining of the script set $url = 'index.php?'.$_SERVER['QUERY_STRING']; then for any specific url you need, you can just do this: $url&specific=blah&etc...
__________________
PHP / mySQL Developer
Reply With Quote
  #5 (permalink)  
Old 10-03-03, 05:27 AM
G M Morris G M Morris is offline
New Member
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Let me explain further-

I am creating a template system, users will be writing their own HTML code into a DB and the system will translate them into pages, the thing is, I want every link they make to have a variable appened to the end of it. meaning, I won't have control over the links in the HTML them selves.
Reply With Quote
  #6 (permalink)  
Old 10-03-03, 05:53 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
So it seems you just want to append just the sid $_GET variable, in that case this may work.

PHP Code:

//$page is a variable that has the page contents as it's value, you'll have to do that part


$page preg_replace('/href="(.+?)"/is','href="\\1'.$_GET['sid'].'"',$page); 
This is, however, dependent on the users using proper html (href="url" instead of href=url)
__________________
PHP / mySQL Developer
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
woof ruff (i'm new with a few questions) APuppyDog PHP 2 07-22-03 10:51 AM
No mail when reply is posted to a thread. phpkid HotScripts Site Bug Reports 5 06-24-03 11:45 AM
New thread in Mozilla Tesco HotScripts Site Bug Reports 2 06-10-03 07:26 AM


All times are GMT -5. The time now is 06:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.