Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » [SOLVED] multiple forms in a single page

[SOLVED] multiple forms in a single page

 
Prev Previous Post   Next Post Next
  #1  
Old 10-08-08, 11:01 PM
id10tn00b's Avatar
id10tn00b id10tn00b is offline
Newbie Coder
 
Join Date: Oct 2004
Location: new mexico
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Question [SOLVED] multiple forms in a single page

hi, im here again as i have searched and keep turning up answers that usually dont have to do with what i want... for instance, if i search for multiple forms in one page or similar variations of wordings, i get people asking about submitting 2 forms, where i just have 2 co-existing forms. one or the other submitted but not both and one dont need to be hidden.

that said, i have a contact page and the navbar that loads in all my pages has a login form if user isnt logged in and only has a small logout form if user is logged in. lets start with the 2 forms in question.

login:
PHP Code:
<?php
...
<
form id="login" action="/contact.php" method="post">
<
table class="auth">
  <
tr>

    <
th colspan="2">
      
Login:
    </
th>
  </
tr>
  <
tr>
    <
td class="auth">
      
Username:
    </
td>
    <
td class="auth">
      <
input type="text" name="username" size="8" maxlength="30" class="auth">

    </
td>
  </
tr>
  <
tr>
    <
td class="auth">
      
Password:
    </
td>
    <
td class="auth">
      <
input type="password" name="passwurd" size="8" maxlength="40" class="auth">
    </
td>

  </
tr>
  <
tr>
    <
td class="auth">
      <
a href="/authenticate/index.php?action=register" title="Register">Free Registry</a>
    </
td>
    <
td class="auth">
      <
input class="logbutton" type="submit" name="login" value="Login">
    </
td>

  </
tr>
</
table>
</
form>
...
?>
contact form:
PHP Code:
<?php
...
<
form id="contact" method="post" action="/contact.php">
<
p><strong>your name (username if registered):</strong><br>
<
input type="text" name="sender_name" value="" size=30></p>
<
p><strong>your email address:</strong><br>
<
input type="text" name="sender_email" value="" size=30></p>
<
p><strong>message:</strong><br>
<
textarea name="message" cols=34 rows=5></textarea></p>
<
p><input type="hidden" name="op" value="ds"></p>
<
p><input type="submit" name="submit" value="send this form"></p>
</
form>
...
?>
the login form appears first in the page source. i tried naming each form with an id, and each form sets its own action to the submit button. if the user is logged in, it will logout the user but for some reason the session doesnt kill per the logout option as you cant log back in without reopening the browser... but that is the least of the problems and i think it is tied to the login and contact separation. solve one issue the rest falls into place.

ok, so here is the deal. the contact form works fine. the login form doesnt work only on the contact page and if you try to login on that page, it actually messes up the session and you have to close the browser and reopen it to create a new session and log in from some other page. the logout works fine from any other page as well, and you can log in and out all day with no problems...

is there a way to form a separation in which form action or what variables are passed or how or ??? that i can use to separate the forms and make the page work?

now that i asked, the answer may come to me. i will post if i figure it out as someone else may be frustrated and looking and getting the wrong answers from other sites...

if you want, i can post the link to the contact form, but only on request as i dont want to be accused of spamming the board.
__________________
http://www.yougetalife.com
i <?php therefore $i == am;
http://www.coredumpcomputerservice.com
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple page view jonnekke PHP 3 10-24-07 06:59 AM
Register user with multiple forms sugarplum PHP 2 10-25-05 01:45 PM
Print Page, Page Breaks - Help spanky1968 PHP 3 11-23-04 05:00 AM
need help creating an update & confirm page mikewooten PHP 1 11-08-04 05:28 PM
HELP!! Multiple forms on one page??? tcooper PHP 5 07-03-04 09:59 PM


All times are GMT -5. The time now is 09:39 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)