holtom Posted July 17, 2007 Share Posted July 17, 2007 Is it possible to call a function from a Form button, as I have a function that auto creates a form and I pass the values to it. Since doing this I can not reset the form as it reads the values and re-puts them back in. Is there a way to call a function or some other way to reset the form. I use the same page for all the changes using Switch to display different things. Here's the scripting for the function... <?php # This function creates a form to [fill in/view] what you have just submitted. # syntax submitit($wording,$sectionbit,$titlebit,$bodybit,$namebit) # $wording = "sentence above form that describes form below"; # $sectionbit = At What section is next when submitted NULL (default) > Preview_News > Submitted > Delete_News_Sure > Delete_Complete > Modify_News > Preview_Mod_News > Modify_News_Sure > Modify_Complete # $titlebit = Displays the variable stored in $titlebit in a text box. # $bodybit = Displays the variable stored in $bodybit in a textbox. # $namebit = Displays the variable stored in $namebit in a textbox. # $submitbutton = Changes the text of the Submit button to this. # $resetbutton = Changes the text of the Reset button to this. function submitit($wording,$sectionbit,$titlebit,$bodybit,$namebit,$submitbutton,$resetbutton) { echo "<font size='-1'><div align='center' class='mainsection'>$wording<br></div></font>"; echo "<form name='start' action='admin_news.php?SectionAt=$sectionbit' method='POST'>\n <table width='500' align='center'>\n"; $timenow=DATE('Y-m-d H:i:s'); echo "<input type='hidden' name='dateNews' value='$timenow'></td></tr>\n <tr><td size='80'><font size='-1'>Title :</font></td><td> <input class='formit' type='text' size='50' maxlength='255' name='titleNews' value='$titlebit'></td></tr>\n <tr><td size='80'><font size='-1'>Body :</font></td><td> <textarea class='formit' cols=38 rows=5 wrap='hard' name='bodyNews' maxlength='255'>$bodybit</textarea></td></tr>\n <tr><td size='80'><font size='-1'>Author :</font></td><td> <input class='formit' type='text' size='20' maxlength='20' name='firstName' value='$namebit'></td> </tr>\n <tr><td colspan='2'><center><input class='formitBUTTON' type='reset' Value=$resetbutton> <input class='formitBUTTON' type='submit' value=$submitbutton></center></td></tr>\n </table>\n </form>\n"; return; } ?php> Thank you all for the help. Quote Link to comment Share on other sites More sharing options...
tapos Posted July 17, 2007 Share Posted July 17, 2007 This is a javascript issue. -- Tapos Pal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.