GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jun-2006, 17:52
SumOking SumOking is offline
New Member
 
Join Date: Jun 2006
Posts: 6
SumOking is on a distinguished road

fast info transfer to next page with $_GET?


I transfer info to the next page using something like:
PHP Code:

<?php ..
  SELECT a table FROM mysql
  fill one colum in $myarray[].. 
;?>
<html> <body>
  <a href="http://host/page2.php?info=<?php echo $myarray[3];?>&...."</a>
</html> </body>

on http://host/page2.php I use
PHP Code:

$info = $_GET['info'];
.... 



My problem: $myarray[3] can contain a wole lot of info like an article
with 1000 words.

My question: is it good/fast to use this combination in my case? It seems that it all pops up in the command bar of the browser and it might make my precious visitors angry. Do I have to use $_SESSION?

I learned CSS one week ago...
Greetings
Daniel
Last edited by cable_guy_67 : 21-Jun-2006 at 18:19. Reason: added [PHP] code tag. Added [NOPARSE] to show url example.
  #2  
Old 21-Jun-2006, 19:24
CalEvans CalEvans is offline
New Member
 
Join Date: Jun 2006
Posts: 1
CalEvans is on a distinguished road
Smile

Re: fast info transfer to next page with $_GET?


Quote:
Originally Posted by SumOking
My question: is it good/fast to use this combination in my case? It seems that it all pops up in the command bar of the browser and it might make my precious visitors angry. Do I have to use $_SESSION?

No, it is best not to transfer large blocks of text in a GET. HTTP 1.0 had a limit of like 1024 chrs for a querystring. 1.1 expanded that but it's not unlimited. You would be better off using a POST.

HTH,
=C=
  #3  
Old 21-Jun-2006, 19:35
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 732
admin will become famous soon enough

Re: fast info transfer to next page with $_GET?


1000 words in the URL??? Wow... CalEvans is right, it's a bad (BAD) idea.

Something to consider: http://support.microsoft.com/default...;en-us;q208427

FYI: you should also familiarise yourself with this function: urlencode() when you include (string) data in GET values. If you have a "&" somewhere within the 1000 word article, you're screwed!
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #4  
Old 22-Jun-2006, 17:51
SumOking SumOking is offline
New Member
 
Join Date: Jun 2006
Posts: 6
SumOking is on a distinguished road

Re: fast info transfer to next page with $_GET?


Thank you for your fast reply! It took some time to figure it out.
I am not 100% sure, but I think POST needs a javascript to work
with a href. Still I think POST is a good command to forward Data.
But I didn´t use it.

I used on page1:

PHP Code:

<?php echo "<a href=http://localhost/page.php?number=".$numberfortext." class=\"ali1\"><p2>".$shorttext[$numberfortext]."</p2></a>"; ?>


and on page 2 (on same server!! using same database):

PHP Code:

<?php
     // SELECT......  as on page1
     $lokalNumber = $_GET['number'];
     $myarray=$allTexts;
?>

<html>
     <p1> <?php echo $myarray[$lokalNumber];?> </p1>
            
</html>


Have Fun
Last edited by SumOking : 22-Jun-2006 at 18:10. Reason: Please insert your PHP code between [php] & [/php] tags
  #5  
Old 22-Jun-2006, 17:59
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 732
admin will become famous soon enough

Re: fast info transfer to next page with $_GET?


Yes, this is what people do normally. Send the ID in the url and on the landing page, use the ID to "SELECT" the data from the database.

It's very (VERY) important for you to validate/verify the $_GET['number'] before you insert it into the query. Usually, you would use the mysql_escape_string function but since you are expecting an integer in this particular instance, it is okay to simply to do this:

PHP Code:

<?php
     $_GET['number'] = intval( $_GET['number'] ); // <-- INTEGER ONLY
     // SELECT......  as on page1
     $lokalNumber = $_GET['number'];
     $myarray=$allTexts;
?>

__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
 
 

Recent GIDBlogNARMY by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need-Space | Reseller and Shared Hosting Plans! nsuk Web Hosting Advertisements & Offers 0 06-Jun-2006 13:43
Do you need affordable, reliable, fast hosting? nsuk Web Hosting Advertisements & Offers 0 29-Mar-2006 08:08
Selling Server darkneal128 Managed / Dedicated Servers 4 28-Mar-2006 17:01
[script] E-mail webmaster error page BobbyDouglas PHP Code Library 0 19-Aug-2003 20:10
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:50.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.