Trevors Posted September 28, 2006 Share Posted September 28, 2006 Heya all,Im currently trying to make a myspace tool where you colorize text of yours in different colors.Im moving the html code through the url and i then catch it with $_GET in another php file.I print the $output into the url, faded.php?output=$output[code]<iframe frameborder="0" name="preview" width="627" src="faded.php?output=<?print $output;?>" height="187" style=margin:0px;padding:0px;></iframe></div><div id="Layer1" style="position:absolute; left:10px; top:216px; width:283px; height:118px; z-index:1; visibility: visible;">[/code]I then catch it in another file using $_GET[code]if(!isset($_GET['output'])){ $output = "";}else{ $output = $_GET['output']; $output = str_replace("~", "#", $output); Print' <div id="Layer3" style="position:absolute; left:0px; top:0px; width:627px; height:187px; z-index:3; background-color: #000000; layer-background-color: #000000; border: 1px none #000000">' . $output . '</div>';}[/code]The problem is that i cant type very long text, is there a limit on how much the url can store?If so what other ways are there?Best RegardsTrevors Quote Link to comment https://forums.phpfreaks.com/topic/22348-trying-to-move-html-code-through-the-url-and-catch-it-with-_get/ Share on other sites More sharing options...
steveclondon Posted September 28, 2006 Share Posted September 28, 2006 In this case I would use a $_SESSION or a hidden $_POST field. Quote Link to comment https://forums.phpfreaks.com/topic/22348-trying-to-move-html-code-through-the-url-and-catch-it-with-_get/#findComment-100089 Share on other sites More sharing options...
Trevors Posted September 28, 2006 Author Share Posted September 28, 2006 how would the session work?Could you code a bit so i could see how you mean.Best Regards Quote Link to comment https://forums.phpfreaks.com/topic/22348-trying-to-move-html-code-through-the-url-and-catch-it-with-_get/#findComment-100166 Share on other sites More sharing options...
wildteen88 Posted September 28, 2006 Share Posted September 28, 2006 To starta session add the follow at the very top of every page, prefereably on line 1, that will use sessionss:[code=php:0]<?php session_start(); ?>[/code]Now to set/read a session:[code=php:0]// set a session var:$_SESSION['session_var_name_here'] = 'some value';//read session var:echo $_SESSION['session_var_name_here'];[/code]So with your problem you'll wnat to do this:[code=php:0]// dont for get to start the session$_SESSION['htmlStuff'] = <<<HTMLadd your html code hereHTML;[/code]Tnen on the page you wnat to use the html you can access it using $_SESSION['htmlStuff'] variable, agian dont forget to added session_start(); at the top of the page.Also make sure THERE IS NO OUTPUT before you use the session_start function. Otherwise your page may fail to load or you'll get a header already sent error message. Quote Link to comment https://forums.phpfreaks.com/topic/22348-trying-to-move-html-code-through-the-url-and-catch-it-with-_get/#findComment-100278 Share on other sites More sharing options...
craygo Posted September 28, 2006 Share Posted September 28, 2006 Yes The GET method has a limit while the POST method does not. You cannot exceed 100 characters in the value for the GET method Quote Link to comment https://forums.phpfreaks.com/topic/22348-trying-to-move-html-code-through-the-url-and-catch-it-with-_get/#findComment-100283 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.