Hello Everyone,
I am creating a function to make making forms a little faster here is my first attempt at it:
This is whats happening, I get the form on the screen and all but if you look at the source through the browers you will see that it not lining up the arguments for the function, I want to be able to use some arguments some times and not other times, so say if I did not want to use the $class one then I would leave this blank, and if I want to use it then I enter it, when used it will not put the $class where it should go and is putting it instead of the $name value its puting the $class value there
I am probly not explaining good but if you read the code and then see the two examples of what is being put out by looking at the source you should see what I am trying to show that happening
Thanks for the help
Christopher
<?php
// $name="name";
// $class="style";
// $value="cpe";
// $display_q="what is your name";
function Form_Gen($type="", $name="name", $class="", $value="cpe", $display_q="what is your name")
{
echo'
<form>
<label for="' . $name . '">' . $display_q . '</label>
<input class="' . $class . '" type="' . $type . '" id="' . $name . '" name="' . $name . '" value="'. $value .'" />
</form>
';}
Form_Gen(text, style);
?>
gives:
<form>
<label for="style">what is your name</label>
<input class="" type="text" id="style" name="style" value="cpe" />
</form>
instead of:
<form>
<label for="name">what is your name</label>
<input class="style" type="text" id="name" name="name" value="cpe" />
</form>