Results 1 to 4 of 4

Thread: PHP inside text area |

  1. #1
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP inside text area |

    Hello

    How can I put PHP script to textarea, so it works correctly.

    I have a PHP script here>
    Code:
    http://fmodding.eu/objectmov/index12.php
    It is a object converter, and I want to display the result of converted objects in text area. on bottom of page

    if you want to "see" what I mean then open the link, paste

    Code:
    CreateObject(18749, 617, 823, 296, 0, 0, 0, 0);
    to first text area and write some small numbers to offset textareas, then hit "Move me"

    it will display the result on bottom of page. I want to see the result inside the textarea.

    Anyone can help me with it?

    Here is the website code
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-4" />
    	<link href="http://www.fmodding.eu/et/css/stiil2.css" rel="stylesheet" type="text/css" media="screen"> 	
    	<link href="http://www.fmodding.eu/et/css/stiilk.css" rel="stylesheet" type="text/css" />
    	<script type="text/javascript" src="http://www.fmodding.eu/et/js/jquery.min.js"></script>
    	<script type="text/javascript" src="http://www.fmodding.eu/et/js/BPreplay.font.js"></script> 
    	<script type="text/javascript" src="http://www.fmodding.eu/et/js/bloooming.roundPic.js"></script>
    	<script src="http://www.fmodding.eu/et/js/application.js" type="text/javascript"></script>
        <script src="jquery.js"></script>
    	<link rel="SHORTCUT ICON" href="http://fmodding.eu/eestisaidikoon.ico"/>
    	<title>Falenone's mapping - #</title>
    
    <meta name="keywords" content="samp, falenone, sa:mp, sa-mp, map, mapid, download, maps, mta, createobject, pawno, kaardid, gta, san, andreas, modd, mod, modifikatsioon, multi, theft, auto, allalaadimine, lae, alla"> 
    <meta name="description" content="Falenone's Mapping - mapid GTA San Andreasele ja selle kahele Multiplayerile. // Falenone's Mapping - Maps for GTA San Andreas and for it's two multiplayers"> 
    <style type="text/css">
    <style type="text/css" media="screen"> 
    	 body * {margin: 0; padding: 0; font-family: helvetica, sans-serif;}
    	 p {margin: 0 0 1em; font-size: 14px;}
    	 
    	 input, textarea, select {
    	 border: 1px solid #111;
    	 padding: 0.5em;
    	 font-size: 15px;
         line-height: 1.2em;
         width: 531px;
         background: #444;
         color: #fff;
         font-family: helvetica, sans-serif;
         background: -webkit-gradient(linear, left top, left bottom, from(#222), to(#444));
         -webkit-appearance: none;
    	 -webkit-box-shadow: 1px 1px 1px #333;
    	 }
    	 
    	 input:focus, textarea:focus, select:focus {outline-color: #c00;}
    	 
    	 textarea {
         height: 310px;
         background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #222), color-stop(0.05, #333));
       }
    	 input[type=text] {
         background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #222), width: 8px, color-stop(0.12, #333));
       }
       
       input[type=submit] {
         width: auto;
         padding: 0.25em 1em;
         line-height: 1.5em;
         background: -webkit-gradient(linear, left top, left bottom, from(#a00), to(#600));
         border: 2px solid #c00;
         text-shadow: 0 0 2px #300;
         font-weight: bold;
         -webkit-box-shadow: 1px 1px 3px #000;
         margin-right: 0.5em;
       }
    
       textarea {
        resize: vertical;
    }
    	</style>
     </style>
     
    <style type="text/css"> 
    
    body 
    { 
    background-image: 
    url('http://www.fmodding.eu/et/images/Tagataust6.jpg'); 
    background-repeat: no-repeat; 
    background-color: black;
    } 
    
    </style>
    	<script>
          $(document).ready(function(){
             $("#output").show(2300);
          });
    	</script> 
    </head>
    	<body>
    		<div id="wrapper">
    			<div id="header">
    				<a id="logo" href="http://www.fmodding.eu/index.php">
    					<img src="http://www.fmodding.eu/et/img/logo.png" alt="drive" />
    				</a>
    				<ul id="nav"> 
    					<li><a href="http://www.fmodding.eu/index.php"><span><img src="http://www.fmodding.eu/et/img/home.png" alt="Esileht" width="11" height="10" /></span></a></li> 
    					<li class="current"><a href="#"><span>##</span></a></li> 
    				</ul><!--navigatsioon-->				
    			</div><!--Header-->			
    		<div id="generalcontent" class="fixed">
    			<div class="content_left">
    						<ul class="breadcrumb">
    							<li class="first"><a href="http://www.fmodding.eu/index.php">Falenone's Mapping</a></li>
    							<li># - #</li>
    						</ul><br>
        <div id="page" align="right" name="page" style="display: none;">
         <form name="inputcode" id="inputcode" method="post" action="<?=htmlentities($_SERVER['REQUEST_URI']);?>">
         <textarea placeholder="Paste your Pawno CreateObject map code here." id="code" name="code" cols="50" rows="20" style="background-color: #424141;"></textarea><br /><br />
          <center>
          X-Offset: <input type="text" placeholder="Write here the X cordinate offset." size="5" id="X" name="X" />&nbsp;<a href="#" id="X_Info" name="X_Info">Info</a><br />
    	  
          Y-Offset: <input type="text" placeholder="Write here the Y cordinate offset." size="5" id="Y" name="Y" />&nbsp;<a href="#" id="Y_Info" name="Y_Info">Info</a><br />
    	  
          Z-Offset: <input type="text" placeholder="Write here the Z cordinate offset." size="5" id="Z" name="Z" />&nbsp;<a href="#" id="Z_Info" name="Z_Info">Info</a><br /><br />	  
          </center>
          <input type="submit" value="Move me!" id="generatecode" name="generatecode" />
         </form><br /><br />
         <div id="InfoBox" name="InfoBox" style="display: none;"></div>	 
    	  <ul class="breadcrumb">
    		<center>Output</center>
       </div>	
    <script>
          var InfoStatus = 0;
          var TabStatus = 0;
          $(document).ready(function(){
             $("#page").show(2500);
             
             $("#X_Info").click(function(event){
                if(InfoStatus == 1){
                   if(TabStatus == 1){
                      $("#InfoBox").hide("slow");
                      InfoStatus = 0;
                      TabStatus = 0;
                   }
                   else{
                      $("#InfoBox").hide("slow", function(){
                         $(this).text("This is the X offset. All objects will be moved. Eg. if you do '5', and an object has X as 3, it'll be 8.NOTE: Leave it empty to ignore");
                         $(this).show("slow");
                         TabStatus = 1;
                      });
                   }
                }
                else{
                   $("#InfoBox").text("This is the X offset. All objects will be moved. Eg. if you do '5', and an object has X as 3, it'll be 8.NOTE: Leave it empty to ignore");
                   $("#InfoBox").show("slow");
                   InfoStatus = 1;
                   TabStatus = 1;
                }
             });
             
             $("#Y_Info").click(function(event){
                if(InfoStatus == 1){
                   if(TabStatus == 2){
                      $("#InfoBox").hide("slow");
                      InfoStatus = 0;
                      TabStatus = 0;
                   }
                   else{
                      $("#InfoBox").hide("slow", function(){
                         $(this).text("This is the Y offset. All objects will be moved. Eg. if you do '5', and an object has Y as 3, it'll be 8.NOTE: Leave it empty to ignore");
                         $(this).show("slow");
                         TabStatus = 2;
                      });
                   }
                }
                else{
                   $("#InfoBox").text("This is the Y offset. All objects will be moved. Eg. if you do '5', and an object has Y as 3, it'll be 8.NOTE: Leave it empty to ignore");
                   $("#InfoBox").show("slow");
                   InfoStatus = 1;
                   TabStatus = 2;
                }
             });
             
             $("#Z_Info").click(function(event){
                if(InfoStatus == 1){
                   if(TabStatus == 3){
                      $("#InfoBox").hide("slow");
                      InfoStatus = 0;
                      TabStatus = 0;
                   }
                   else{
                      $("#InfoBox").hide("slow", function(){
                         $(this).text("This is the Z offset, aka the height. All objects will be moved. Eg. if you do '5', and an object has Z as 3, it'll be 8.NOTE: Leave it empty to ignore");
                         $(this).show("slow");
                         TabStatus = 3;
                      });
                   }
                }
                else{
                   $("#InfoBox").text("This is the Z offset, aka the height. All objects will be moved. Eg. if you do '5', and an object has Z as 3, it'll be 8.NOTE: Leave it empty to ignore");
                   $("#InfoBox").show("slow");
                   InfoStatus = 1;
                   TabStatus = 3;
                }
             });
             
             $("#generatecode").click(function(event){
                $("#page").hide("fast");
             });
             $("a").click(function(event){
                event.preventDefault();
             });
          });
       </script>   
    			</div><!--Sisu-->
    		<div class="content_left">
    				<body>
    		<div id="output" align="center" style="display:none;">
    		<br>
    		<?php
    		   $CreateObject_CODES = explode("\n", nl2br($_POST['code']));
    		   
    		   foreach($CreateObject_CODES as $CreateObject)
    		   {
    			  list($modelid, $X, $Y, $Z, $rX, $rY, $rZ, $DrawDistance) = explode(",", $CreateObject);
    			  
    			  if(strlen($_POST['X'])) $X = (float) $X + $_POST['X'];
    			  if(strlen($_POST['Y'])) $Y = (float) $Y + $_POST['Y'];
    			  if(strlen($_POST['Z'])) $Z = (float) $Z + $_POST['Z'];
    			  
    			  echo "$modelid, $X, $Y, $Z, $rX, $rY, $rZ, $DrawDistance";
    		   }
    		?>
    		</div></body>
    			<div class="pusher"></div>
    		</div>
    		</div><!--Alumine lõpp-->
    	</body>
    </html>
    Last edited by Falenone; 05-01-2011 at 06:02 PM.

  2. #2
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Anyone can't or don't want to help?

  3. #3
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Looks like none gonna help

    Admins: Close the thread

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You are asking for a lot of help with a lot of code to read. If you want free help, then please make it easier for us by posting specific questions about small amounts of code. If you need more help than that, you may need to get paid help.


    From what I understand, I think the problem may be the order of processing.

    PHP is a serverside language that generates HTML (and Javascript, CSS, etc.). It processes once on the server then the output is sent to the browser. It ONLY operates this one time, and it will not run again until the page is reloaded.
    Javascript is a clientside language that operates on an active HTML page.

    So when you submit the form, the page reloads and everything resets.

    There are two solutions:
    1. Use Javascript only.
    2. Use Ajax to load the PHP through Javascript. (Ajax is a way to "reload" part of the page without actually refreshing the page. It works by doing a hidden request for a new page that has the updated content.)
    Last edited by djr33; 05-07-2011 at 01:18 AM.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •