I am wondering, is there any way to create a form inside of a php page?
If so, how?


Recommended Answers

All 7 Replies

what do you mean form. Do you mean like a form in vb/c++ or form like text boxes, check-boxes etc

Please, give us more detail for your problem.

sorry about that...
a form like check boxes and text areas. Not sure if this is possible..

You can use html to design the forms that you need then use php to call on there values for example if i have a text box like this

<input type="text" name="Name" id="Name" />

i can get the values from that text box using php like this

$name = $_POST['Name'];

which means whatever value you type in the text box will be assigned to $name and you can use that to code.

thanks, but what if the value is in a previous page. I want to use php to make a value appear in a form when a specific link is clicked pertaining to an id number.

On the previous page I used a form with an initial value set to an id number. On submit, a .php page opens and the id number is displayed...

$id_number = $_POST['anumber'];

I want this number to be placed in a formfield on the .php page (if it cannot be placed in a formfield, having it displayed on the top of the page would be ok), and underneath, I want the user to be able to enter more information....

It sounds like you are setting a multiple page form/wizard. You can display the id to the user using something like this:

<!-- Page 2 of form. -->
<form action="something.php" method="post" >
<input type="hidden" name="id" value="<?php echo $_POST['id'];?>" />
<label>ID:</label> <?php echo $_POST['id'];?>
<label for="more_info">More Info:</label><textarea name="more_info" id="more_info"></textarea>

That lets you display the id if you want and to keep it for the next submit (without the user easily changing its value) in the hidden field.

exactly what I needed:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.