stribor40 Posted August 2, 2013 Share Posted August 2, 2013 i already completed this part,. form1.html data gets entered and processed with form1.php. Data is passed with ajax. This form has only one button to submit form. Now i have form2.html which is exaclty same as form1.html. It is processed with form2.php and it shows data entered in form1.html and the only difference is that it shows 2 buttons instead of 1. Is there anyway that I can get this done using only one html and php rather than using 2 html and 2 php files. any suggestion is much appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/280780-how-to-process-form-in-better-way/ Share on other sites More sharing options...
Strider64 Posted August 2, 2013 Share Posted August 2, 2013 You might be able to do what you talking about with an if statement. For example I do that with a form I'm using protected function addForm($formPage, $sticky, $title = NULL, $content=NULL) { // Creat a form: $this->getForm = '<div id="format-form">'; $this->getForm .= '<form action="' . $formPage . '" method="post">'; $this->getForm .= '<input type="hidden" name="action" value="enter" />'; if ($sticky == 'yes') { $this->getForm .= '<select id="basic" name="sticky">'; $this->getForm .= '<option selected="selected" value="no">Sticky Thread?</option>'; $this->getForm .= '<option value="yes">yes</option>'; $this->getForm .= '<option value="no">no</option>'; $this->getForm .= '<option value="sysop">sysop</option>'; $this->getForm .= '</select>'; } if (isset($title)) { $this->getForm .= '<br><br>'; $this->getForm .= '<label class="label-styling" for="style-title" >Title</label>'; $this->getForm .= '<br>'; $this->getForm .= '<input type="text" maxlength="40" id="style-title" name="title" value="' . $title . '">'; $this->getForm .= '<br>'; } $this->getForm .= '<br><br>'; $this->getForm .= '<label class="label-styling" for="style-textarea">Content</label>'; $this->getForm .= '<textarea class="expanding" name="content" id="content-style">' . $content . '</textarea>'; $this->getForm .= '<br>'; $this->getForm .= '<input class="submit-btn-style" type="submit" name="submit" value="Submit Blog">'; $this->getForm .= '<br>'; $this->getForm .= '</form>'; return $this->getForm; Quote Link to comment https://forums.phpfreaks.com/topic/280780-how-to-process-form-in-better-way/#findComment-1443278 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.