What's wrong with my PHP code?

Jordan

New member
Okay, so I didn't turned off the register_globals in php.ini file in XAMPP. That's why I always write $_POST['name'] ,$_GET['name'] and $_REQUEST['name']. That's my own preference so that I'll be an effective PHP coder.

So how do I edit my code considering that I didn't turned on the register_globals on the php.ini file??

Here's my code for borderMaker.html:

<html>
<!-- borderMaker.html -->
<head>
<title>Border Maker</title>
</head>

<body>
<center>
<h1 align="center">Border Maker</h1>
<br>
<h3>Demonstrates how to read HTML form elements</h3>
<br>

<h3>Text to modify</h3>

<br>

<form method="POST"
action="borderMaker.php">

<textarea name="basicText"
rows="10"
cols="40">
Four score and seven years ago our fathers brought forth on this
continent a new nation, conceived in liberty and dedicated to the
proposition that all men are created equal. Now we are engaged in a
great civil war, testing whether that nation or any nation so
conceived and so dedicated can long endure.
</textarea>

</form>

<table border = "1">
<!-- for our first row -->
<tr>
<td><h3>Border style</h3></td> <td cols span="2">Border Size</td>
</tr>

<!-- for our second row -->
<tr>
<!-- for the dropdown list -->
<td>
<select name= borderStyle>
<option value="ridge">ridge</option>
<option value="groove">groove</option>
<option value="inset">inset</option>
<option value="outset">outset</option>
</select>
</td>

<td>
<select size="5"
name = borderSize>
<option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
<option value = "5">5</option>
<option value = "10">10</option>
</select>
</td>

<td>
<input type="radio"
name="sizeType"
value="px">pixels<br>

<input type="radio"
name="sizeType"
value="pt">points<br>

<input type="radio"
name="sizeType"
value="cm">centimeters<br>

<input type="radio"
name="sizeType"
value="in">inches<br>
</td>

</tr><!-- end of second row -->

</table><!--end of table -->

<input type = "submit"
value="show me">

</form><!--end of form-->

</center>


</body>
</html>




AND THIS ONE IS MY CODE for borderMaker.php:

<html>
<!--borderMaker.php-->

<head>
<title>Your Output</title>
</head>

<body>

<h1>Your Output</h1>

<center>
<?

$borderSize = $_POST["borderSize"];
$sizeType = $_POST["sizeType"];
$borderStyle = $_POST["borderStyle"];


$theStyle = <<<HERE
"border-width:$borderSize $sizeType;
border-style: $borderStyle;
border-color:green"
HERE;

$basicText = $_POST["basicText"]; //basicText variable declaration

print "<div style = $theStyle>";
print $bsicText;
print "</span>";

?>
</center>

</body>
</html>


I know i need to edit some lines here. I just don't know what to add and what part considering that I didn't turn off my register_globals in php.ini

Please help me to make this work and explain.

thanks.
 
Back
Top