473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

About Submit Button

150 100+
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Test</title>
  4. </head>
  5.  
  6. <body>
  7. <form id="form1" name="form1" method="post" action="indexs.php">
  8. <input type="text" name="username" id="username" value="<?php echo $_POST['username'];?>"/>
  9. <br />
  10. <input type="text" name="pass" id="pass" />
  11. <br />
  12. <input type="submit" name="button" id="button" value="Submit" />
  13. </form>
  14. <?php
  15. $_POST['username'];
  16. $_POST['pass'];
  17. function handle_errors($input,$msg){
  18. if($input==""){
  19. echo "<span class='RED'>".$msg."</span><br />";
  20. }
  21. }
  22. handle_errors($username,"Fill user Field");
  23. handle_errors($pass,"Fill password Field");?>
  24.  
  25. </body>
  26. </html>
  27.  
i need help in this code i want handle_errors function not to be executed until i press the Submit button .
Jul 19 '07 #1
2 1164
abertay
10
simple...
put your function in an if block.....

something like

Expand|Select|Wrap|Line Numbers
  1. if($_POST['name_of_submit_button '])
  2. {
  3.  
  4. and call your function here......
  5. handle_error($something,$something)
  6.  
  7. }
  8.  
Jul 19 '07 #2
ak1dnar
1,584 Expert 1GB
Please enclose php scripts using code tags

[code=php]

your code goes here

[ /code]


Thanks!
-Ajaxrand
Jul 19 '07 #3

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

Similar topics

3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
4
by: John | last post by:
I am a VB programmer and know nothing about Javascript. I have a Java Button in my asp page (It came with Visual Studio 6) and I want it to open a page called DBSearch.asp. I also want it to take...
15
by: Mattia | last post by:
Hi! I have a <form> that can be submitted thruogh three buttons and I need to tell witch one was pressed when the form was submitted. I now do it with 3 <input type="submit" name="..."...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
3
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm...
5
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
6
by: wASP | last post by:
Hello everyone, I'm new to C# and ASP.NET, so pardon my stupidity on this one. I'm having a problem with referencing methods/functions external to a class member function. My code is as...
2
by: pc | last post by:
I've created a simple form with a submit button and a textfield. I assigned a RequiredFieldValidator to the textfield and set EnabledClientScript to ture. I noticed the validator did not display...
11
by: wolf | last post by:
There are three webcontrol on my asp.net form: a TextBox, a submit button and a RegularExpressionValidator. And I had set ControlToValidate property of the RegularExpressionValidator to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...

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.