473,503 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to submit the data although it return false?

150 New Member
im having two problems with my site, i wrote Javascript code into my page to return true if the data that was entered was correct else return false and im having two buttons to submit the data
EX:


this button to check for availability and the other to check that all data are correct to insert into it database in the same form.
EX:


The other problem, i want to login in the same page im already on and make the form disappear when i enter the correct data how to do that
EX:

Jul 23 '07 #1
2 1374
nathj
938 Recognized Expert Contributor
im having two problems with my site, i wrote Javascript code into my page to return true if the data that was entered was correct else return false and im having two buttons to submit the data
EX:


this button to check for availability and the other to check that all data are correct to insert into it database in the same form.
EX:


The other problem, i want to login in the same page im already on and make the form disappear when i enter the correct data how to do that
EX:

If I understand, and forgive me if I don't, you want the login page to POST the form data back to itself and then display something different if the login was sucessful?

If this is the case I would have the login page first check $_POST data to see if the items have been set. If they have then check if they are correct. If they have not then display the form.

If the items are correct display what you want to display to users logged in otherwise show the form with some text explaining the error and offering help such as reminders.

Here's some psuedo code.
Expand|Select|Wrap|Line Numbers
  1. if (isset($_POST['user']) && isset($_POST['password']))
  2. {
  3.   if(username=valid && password=valid) //psuedocode
  4.   {
  5.   $lnIsValid  0;
  6.   }
  7.   else
  8.   {
  9.   $lnIsValid = 2;
  10.   }
  11. }
  12. else // not set
  13. {
  14.   $lnIsValid = 1;
  15. }
  16.  
  17. switch($lnIsValid)
  18. {
  19.   case 0:
  20.    echo "Welcome";
  21.    break;
  22.   case 1: // display form for the first time
  23.    include("form.php") ; // we can then use this later
  24.    break;
  25.   case 2:
  26.    include("form.php");
  27.    echo "the data entered did not match do you need assistance"; //offer password reminder etc
  28.   break;
  29. }
  30.  
This is just a quick peice of psuedo code, but hopefully it will point you in the right direction.

Don't forget, you can always post back if you need more help
Cheers
nathj
Jul 23 '07 #2
smartic
150 New Member
Thank you for replay but my real problem is i;m having javascript into the form [HTML]onsubmit="return validation()"[/HTML] when i click the availability button it check if all the data are correct and don't return thing thank you.
Jul 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
24509
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('',...
1
8308
by: Stanimir Stamenkov | last post by:
Here's an example: <form action="bogus" method="post"> <p> <a href="prev.cgi"><input type="submit" name="prev" value="< Back"></a> <a href="next.cgi"><input type="submit" name="next"...
10
19307
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
3
1412
by: Matt | last post by:
When the user click the submit button in myform.asp, then it will invoke the javascript to check the form data. I want to know if we need document.myform.submit(); ?? Because even I comment it...
2
4873
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I...
1
3404
by: Piotr | last post by:
I have popup window (window.open) where I put any value in input field. After submit I wan to to return to the main window and get value from popup window. How to close popup window and return to...
8
3326
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
4
3493
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
6
4960
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.