Current location: Hot Scripts Forums » Programming Languages » PHP » problem: show/hide button erases field input


problem: show/hide button erases field input

Reply
  #1 (permalink)  
Old 09-09-09, 12:16 PM
esandra esandra is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 47
Thanks: 1
Thanked 0 Times in 0 Posts
problem: show/hide button erases field input

Here is a code for a single button that shows/hides the rules in my sign up page, I have this button right before the submit button in the page..my problem is every time I click it, all the information that the user has typed in into the fields gets lost. What alternatives can I use to solve this problem, does anyone has any idea of what I should change or add into this? I'm thinking of ajax but I totally don't know how to apply/use it in any sense. Thank you very much and any help will be much appreciated.
PHP Code:

<input type="submit" name="<?php if (isset($_POST['view'])){echo"hide";}
                                else
                                echo
"view";?>
                    value="<?php if (isset($_POST['view'])){echo"hide";}
                                else
                                echo
"view rules";?>" >
__________________________________________________ ______________________
Edit: Application of the button above.
PHP Code:

if (isset($_POST['view'])){
            echo
"<the rules>";
            }
            else            
                    
?> 

Last edited by esandra; 09-09-09 at 12:28 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-09-09, 02:15 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Use type="button" and onclick="document.getElementById('rules').style.di splay="none" to hid the rules.

type="submit" sends the form to the server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
formmail problem gscraper Perl 12 08-27-04 04:06 AM
show/hide div's problem in Netscape lgmdm JavaScript 0 05-12-04 09:17 AM
ASP dynamic button problem kasic ASP 2 05-10-04 10:17 AM
Back button problem selvam PHP 3 05-07-04 10:41 AM
Problem with SWITCH function in Radio Button group maverickblair PHP 1 02-27-04 11:49 AM


All times are GMT -5. The time now is 01:21 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.