Welcome to PHPBuilder!
davisshannon;11044207 wrote:I'm trying to create a form with a number of rows based on user defined input (e.g. the user inputs the number 5 and a form with 5 rows is created) and am having difficulty.
While PHP can certainly do this, you should keep in mind that PHP runs on the server and this operation is easily accomplished on the client side (i.e., in your browser) and does not require any information from the server.
davisshannon;11044207 wrote:I have a simple html form that requests this info and then want to pass that to a php script to generate the form with the required number of rows. Can someone help please? Here is the html that I was using to pass the data. Please be gentle as I'm no developer, just a networking guy.
When posting code on phpbuilder, please use the code formatting tags -- it makes your code infinitely easier to read.
davisshannon;11044207 wrote:<!DOCTYPE html>
<html>
<body>
<form action="sizing.php" method"post">
Number of Branches:<br>
<input type="text" name="branch">
<br>
Number of Data Centres:<br>
<input type="text" name="dc">
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
Thanks
OK so you have some inputs:
branch
dc
* submit
Your form is constructed to perform a POST operation to the file "sizing.php". Do you have any code in sizing.php yet? If you do not, I would suggest starting by looking at the values that have been supplied by your POST operation:
if($_SERVER['REQUEST_METHOD'] == 'POST') {
// this command outputs all of the data sent via a POST operation.
var_dump($_POST);
} else {
// request was not a POST operation
die("Sorry, but you have to POST to this file for it to work properly");
}