How to change this code in order to work another way

hieupro123

New Member
I have this code :\[code\]<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script> $(function() { $(".button").click(function() { var dataString = "message= "+$('#message').val(); $.ajax({ type: "POST", url: "calculate.php", data: dataString, success: function(data) { $('#result').append("<div id='message'> "+ data +" </div>"); } }); return false; }); }); </script> </head> <body> <div class="content"> <?php displayForm(); function displayForm() { ?><div id="result"></div> <div class="content2"> <form action="practicalTask.php" method="post"> <div class="firstLine"> <label for="message"> Message </label> <div class="time"> Time </div> </div> <div class="secondLine"> <input type="text" name="message" id="message" onclick="this.value='';" onblur="this.value=http://stackoverflow.com/questions/3799996/!this.value?' Please enter a message...':this.value;" value="http://stackoverflow.com/questions/3799996/Please enter a message..." />pr <input type="submit" name="submitButton" class="button" value="http://stackoverflow.com/questions/3799996/OK" /> </div> </form> <br/> </div> <div id="result"></div> </div> <?php } ?> </body> </html>\[/code\]this is the calculate.php : \[code\]<?php // Check the sum of the charachters of the message entered by user // Assumption - only white space is not a charachter $feel = "Sorry"; $count = 0; $message = $_POST["message"]; $string = trim($message); for ($i=0; $i<strlen($string); $i++) { // ord() - cast to ascii $count += ord($string[$i]); } if ( $count%2==0 ) { $feel = "Glad"; } $result = $feel . " to hear that ..."; // Server side date for the result $date = date('d/m/Y H:i'); $form = " <div class=\"content2\"> <form action=\"practicalTask.php\" method=\"post\"> <div class=\"firstLine\"> <label for=\"message\">Message</label> <div class=\"time\"> Time </div> </div> <div class=\"secondLine\"> <input type=\"text\" name=\"message\" value="http://stackoverflow.com/questions/3799996/. $message ."> <input type=\"submit\" value=http://stackoverflow.com/"OK\" /> <div id=\"time\"> " . $date . "</div> </div> </form> </div>"; echo $form; $resultLine = "<div class=\"firstLine\"> Result </div> <div class=\"resultLine\"> <div class=\"result\"> <p class=\"" .$feel . "\">" . $result . "</p> </div> <div class=\"timestamp\"> <p class=\"" . $feel . "\">" . $date . "</p> </div> </div>"; echo $resultLine; echo "<div class=\"margintop\"> <img src=http://stackoverflow.com/"sepsmall.jpg\" /> </div>";?>\[/code\]I want to change the way it works, in order that the new line (where i write the new things) will be at the bottom. i tried many ways, they all failed.Thanks a lot..
 
Back
Top