Click here to Skip to main content
15,920,005 members
Home / Discussions / Web Development
   

Web Development

 
QuestionForm submit error message Pin
Tichaona J29-Apr-13 5:04
Tichaona J29-Apr-13 5:04 
I am trying to get my code to check the “username” field and print an error message letting the user know that they left a field blank. Now before all I had was the below code of which it worked in part, in the sense that the below code was executed when the submit button was clicked on and when the page was refreshed.

PHP
if (isset($_POST['username'])) {

            emptyField();

                      }


              function emptyField()
                 {
                   $var1 = "">*Field missing entry...";
                  echo $var1;
                 }


To fix this I the added the below code, which now meant that the code only worked if the user clicked on the submit button and didn’t work if the page is refreshed. However I’ve also noticed that even when there is text in the “username” field and say the user got there password wrong (not proceeding to the next page), it simply cleared all fields and printed “*Field missing entry...*” Why is this and how do I sort this out…?

PHP
<?php


                           if(isset($_POST['submit']))
                               {
                                   fieldChecker();
                               }


                             function fieldChecker(){

                                   // if the field is empty...
                                   if (isset($_POST['username'])) {

                                       emptyField();

                                        }

                             }

                                function emptyField()
                                   {
                                     $var1 = "">*Field missing entry...";
                                    echo $var1;
                                   }
                         ?>

AnswerRe: Form submit error message Pin
rpprojects16-May-13 16:11
rpprojects16-May-13 16:11 
GeneralRe: Form submit error message Pin
Tichaona J26-May-13 7:37
Tichaona J26-May-13 7:37 
GeneralRe: Form submit error message Pin
David Kroj26-May-13 23:54
David Kroj26-May-13 23:54 
Questioncrystal reports not working for visual studio 2010 Pin
Member 999911226-Apr-13 7:05
Member 999911226-Apr-13 7:05 
AnswerRe: crystal reports not working for visual studio 2010 Pin
Sandeep Mewara26-Apr-13 7:33
mveSandeep Mewara26-Apr-13 7:33 
GeneralRe: crystal reports not working for visual studio 2010 Pin
Member 999911226-Apr-13 7:35
Member 999911226-Apr-13 7:35 
QuestionGMail SMTP Outgoing Problem Pin
DarkSorrow3825-Apr-13 3:58
DarkSorrow3825-Apr-13 3:58 
AnswerRe: GMail SMTP Outgoing Problem Pin
Bernhard Hiller26-Apr-13 0:36
Bernhard Hiller26-Apr-13 0:36 
GeneralRe: GMail SMTP Outgoing Problem Pin
DarkSorrow3830-Apr-13 3:09
DarkSorrow3830-Apr-13 3:09 
AnswerRe: GMail SMTP Outgoing Problem Pin
Richard MacCutchan30-Apr-13 6:29
mveRichard MacCutchan30-Apr-13 6:29 
QuestionGetting Error while transferring records from one database to other using web application Pin
Parag Raibagkar22-Apr-13 20:13
Parag Raibagkar22-Apr-13 20:13 
AnswerRe: Getting Error while transferring records from one database to other using web application Pin
Sandeep Mewara22-Apr-13 22:43
mveSandeep Mewara22-Apr-13 22:43 
QuestionDisplaying data in chart with import csv file to database sql Pin
Dhimas Yuli PW22-Apr-13 16:34
Dhimas Yuli PW22-Apr-13 16:34 
AnswerRe: Displaying data in chart with import csv file to database sql Pin
Jasmine250123-Apr-13 8:18
Jasmine250123-Apr-13 8:18 
QuestionHelp trying to set a 12 hour cookie for a DHTML popup Pin
Member 1000506922-Apr-13 5:36
Member 1000506922-Apr-13 5:36 
QuestionCheckbox check should automatically and slowly fadeout to unchecked Pin
Member 937599314-Apr-13 7:57
Member 937599314-Apr-13 7:57 
AnswerRe: Checkbox check should automatically and slowly fadeout to unchecked Pin
Martin-OHV14-Apr-13 23:32
Martin-OHV14-Apr-13 23:32 
AnswerRe: Checkbox check should automatically and slowly fadeout to unchecked Pin
Jasmine250122-Apr-13 11:11
Jasmine250122-Apr-13 11:11 
QuestionWebsite conversion Pin
Onose13-Apr-13 4:27
Onose13-Apr-13 4:27 
AnswerRe: Website conversion Pin
Martin-OHV14-Apr-13 23:35
Martin-OHV14-Apr-13 23:35 
QuestionHelp with project. JavaScript • CSS • SVG • HTML Pin
mamouch32013-Apr-13 2:36
mamouch32013-Apr-13 2:36 
QuestionRails Facebook Login Plug-in keeps timing out Pin
SimonHerd13-Apr-13 0:48
SimonHerd13-Apr-13 0:48 
Questionhide printer dialog box in javascript Pin
SumairaR11-Apr-13 1:03
SumairaR11-Apr-13 1:03 
AnswerRe: hide printer dialog box in javascript Pin
dusty_dex11-Apr-13 2:22
dusty_dex11-Apr-13 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.