Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created two pages each using a different page template. I have a form on the first page and when I click on the submit button I want to move to my other custom page. This should be so simple but I can't figure it out. My last try was: action="" but that just displays my original page. Any help would be appreciated. Thanks.

share|improve this question
1  
Post to your second page. –  NightHawk Nov 18 '12 at 23:38
    
If its no loss to merge the separate pages then you can do a simple if/else to display either the form, or other content, depending on whether the form has been submitted. –  Stephen Harris Nov 19 '12 at 1:11
    
Thank you. I started out with everything in my template.php file but couldn't figure out how to make the form disappear after clicking submit and then displaying the html which is now my second page. Include just adds content to what's already there. I figured I had to make it separate page. –  user1833986 Nov 20 '12 at 3:50

1 Answer 1

Try making the form action the url of the second page, so if your second page is at www.example.com/page-two-of-form/:

<form action="/page-two-of-form/">
share|improve this answer
    
Yes, thank you, I tried that using the complete url in quotes after the action= command on the submit form. It tries to open the second page but gives a fatal error when it gets to the get_header() function. The second page opens without any problems when opened by itself but has problems when called from the first form. I don't get it. –  user1833986 Nov 20 '12 at 3:44
    
Sounds like you might have an error in the code that processes your form. Can you post the code? –  guiniveretoo Nov 20 '12 at 17:12
    
Sure. The only thing I'm trying to do with the form at this point is move to the next page using the form action. I have the same problem with just placing the link on the page. The error messages on the second page say that my functions can't be found, but they are found when I open the page on its own. Here is page one: –  user1833986 Nov 21 '12 at 5:06
    
' <!DOCTYPE html> <html lang="en-US"> <head> <title>Application Login</title> <meta charset="windows-1252"> </head> <html> <body> <form name="login" action="myserver.com/wp-content/themes/atahualpa373/…; Username:<input type="text" name="user" style="margin-left:6px;"> Password:<input type="password" name="pwd" style="margin-left:10px;"> <input type="submit" value=" Login " style="background-color:green; font-weight:bold; color:white;"></p> </form> </body> </html> –  user1833986 Nov 21 '12 at 5:15
    
When you say "when I open the second page on its own" are you opening exactly the same url that you enter into the form action? Because you shouldn't ever be opening that file directly through the url in the browser. Wordpress functions can't be found because you're bypassing loading Wordpress by attempting to open the theme file directly. Add a header to the members.php file to make it a custom template, then create a page in the Wordpress backend for your second page, and set it to that custom template. Then change the action on the form to the url of the Wordpress page. –  guiniveretoo Nov 21 '12 at 16:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.