I need to Create a simple form with one text field for the user to enter their name (or any string).
When the submit button is pressed the output is displayed in a table.
Is this code right:
$strName = "Simon Stobart";
Â*echo "<table border='1' width='300'>";
echo "<tr align='center'>";
for ($intLetter=0;$intLetter<13;$intLetter++)
echo "<td>$intLetter</td>";
echo "</tr>";
echo "<tr>";
for ($intLetter=0;$intLetter<13;$intLetter++)
echo "<td align='center'>" . $strName{$intLetter} . "</td>";
echo "</tr>";
echo "</table>";
The code for my form:
<h2> Enter your Name: </h2>
<form action='<?php echo $_SERVER["PHP_SELF"]; ?>' method='post'>
<p>
<label for="strName">Name:</label>
<input type="text" name="strName" value='<?php echo $strName ?>' id='strName'/>
</p> <p>
<input type="submit" name="submit"/>
</p>
</form>
Do I need to add anything else?
When the submit button is pressed the output is displayed in a table.
Is this code right:
$strName = "Simon Stobart";
Â*echo "<table border='1' width='300'>";
echo "<tr align='center'>";
for ($intLetter=0;$intLetter<13;$intLetter++)
echo "<td>$intLetter</td>";
echo "</tr>";
echo "<tr>";
for ($intLetter=0;$intLetter<13;$intLetter++)
echo "<td align='center'>" . $strName{$intLetter} . "</td>";
echo "</tr>";
echo "</table>";
The code for my form:
<h2> Enter your Name: </h2>
<form action='<?php echo $_SERVER["PHP_SELF"]; ?>' method='post'>
<p>
<label for="strName">Name:</label>
<input type="text" name="strName" value='<?php echo $strName ?>' id='strName'/>
</p> <p>
<input type="submit" name="submit"/>
</p>
</form>
Do I need to add anything else?