Hey, can anybody tell me why this scrip isn't working? I'm sure the code is right, but when the page is opened in a browser, the php code is filled it the text field. Also the php code shows up in the html source code (?). I'm using Wordpad as my text editor and saving my files as text files with a .php extention (my_file.php). Can anyone help?
<body>
<h1>Reverse String</h1><hr />
<?php
if (!isset($_GET['input_text']))
echo "<p>Enter the string you want to reverse.</p>";
else{
$ForwardString = $_GET['input_text'];
$ReverseString = strrev($ForwardString);
echo "<p>'$ForwardString' spelled backwards is '$ReverseString'.</p>";
}
?>
<form action="ReverseString.php" method="get" enctype="application/x-www-form-urlencoded">
<p><input type="text" name="input_text" size="20" value="<?php if (!empty($_GET['input_text'])) echo $_GET['input_text'] ?>" /></p>
<p><input type="submit" value="Reverse String" /></p>
</form>



Reply With Quote


Bookmarks