PDA

View Full Version : dynamic form


adique_7
05-16-02, 00:46
hi there..
i'm the new in php.now, i'm on developing payroll system using php........

can u give the some samples how to create dynamic form, that have the buttons like Add, Edit and Delete?

and how're the commands?

i'm not clear in this topic.plz help me

KNSPAA
05-17-02, 08:32
Something like tihis:
<?php
if ("Add" == $insert) {
////// put your sql statement here
}
?>

<form action="<?php echo($PHP_SELF); ?>" name="form1" method="post">
<input type="text" name="description" size="40" >
<p>
<input type=submit name="insert" value="Add">
</p>
</form>

So the form calls itself when the Add button is pressed and does the trick. And sameway with the others...

-Petri-

adique_7
05-18-02, 04:57
hi there...

may i know what is PHP_SELF?
it's using for what?

KNSPAA
05-20-02, 09:51
$PHP_SELF is a php's internal variable and gives the url's name. So with that you can always call the same form, where you just gives the command. Otherwise it will call index files. So your php form script is example.php which includes also the form and add buttom and so on. With that $PHP_SELF in action, you call the example.php again. And now the variable $insert="add". More information from internal variable you can find from php.net.