Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2004, 12:50 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with a Javascript function

Hi, this is my problem:

I have an usual Login page (user name and password), works fine, but later I wanted to erase the fields when the Submit button was clicked, so I wrote a small function in JavaScript (don´t know much Javascript, so I looked in the net for info).
FInally, the erase function works fine, but now the user name and password are not submitted! I get nothing with:

<? $nick=$_POST['txtnick']; ?>

in the page that is linked to the login page.

the function is this:

function clean(Formu) {
  Formu.txtnick.value=""
  Formu.txtpass.value=""
}

And I call the function from the submit button:

<input type="submit" name="Submit" value="Log in" onClick="clean(document.form2)">

How I solve this problem? or what is the correct way to do it?

Thanks
SuMajestad

PD: Sorry for my english, I´m from Mexico

Reply With Quote
  #2 (permalink)  
Old August 17th, 2004, 01:01 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Why do you need the fields to be cleared?

If you clear the fields before the form is submitted, that information won't be present in the POST / GET data. It sounds a little over the top to want to clear the fields. I would just take precautions that cookies aren't made or saved, you're using SSL to submit the data and the data isn't redisplayed to the user, whereas sensitive information won't make its way to the browser's cache, otherwise you ought to be alright.

Espere que esto ayude! Adios! :-)

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
Reply With Quote
  #3 (permalink)  
Old August 17th, 2004, 09:22 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rich:

The Login form I talked about it´s on a frame that is located left in the home.htm of my site, it´s like a quick Login, all the other pages are displayed in other frame(center), so I need to clear the fields because they are always visible.


SuMajestad


Reply With Quote
  #4 (permalink)  
Old August 17th, 2004, 12:20 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I see, so you have the field in the left frame set to target the right frame. In that case then, I would put the javascript in the page that loads in the right frame, then once that page loads the information visible in those fields is wiped out.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
Reply With Quote
  #5 (permalink)  
Old August 17th, 2004, 09:04 PM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rich:

I followed your advise, and now it´s working fine!


Muchas gracias, amigo!

SuMajestad

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stop current javascript function using javascript sakthi Javascript 3 June 2nd, 2008 03:30 PM
Problem with JavaScript function parseFloat parthi_vep Javascript 3 May 26th, 2008 07:49 AM
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 06:03 AM
get value from javascript function suzila ASP.NET 1.0 and 1.1 Basics 6 December 3rd, 2005 10:38 AM
JavaScript: what is the function of "length" in th gilgalbiblewheel Javascript 2 March 9th, 2005 07:17 PM



All times are GMT -4. The time now is 10:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.