Click here to Skip to main content
       

Web Development

 
QuestionRe: help with word wrap please PinprofessionalRichard Deeming9-May-13 2:10 
QuestionDatabase Error PinmemberRajib087-May-13 22:56 
Generalhelp for Google +1 button PinmemberGnana Akilan7-May-13 8:54 
GeneralRe: help for Google +1 button PinmvpSandeep Mewara7-May-13 23:03 
Questionnew to programming and need to write a virtual classroom program Pinmemberdowells7-May-13 2:02 
AnswerRe: new to programming and need to write a virtual classroom program PinmvpRichard MacCutchan7-May-13 2:53 
QuestionHow Best to Build Web App to Receive & Post Async Data From Server PinmemberMember 817307430-Apr-13 8:43 
QuestionForm submit error message PinmemberTichaona 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.
 
 
                   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     
                          
                          
                            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 Pinmemberrpprojects16-May-13 16:11 
GeneralRe: Form submit error message PinmemberTichaona J26-May-13 7:37 
GeneralRe: Form submit error message PinmemberDavid Kroj26-May-13 23:54 
Questioncrystal reports not working for visual studio 2010 PinmemberMember 999911226-Apr-13 7:05 
AnswerRe: crystal reports not working for visual studio 2010 PinmvpSandeep Mewara26-Apr-13 7:33 
GeneralRe: crystal reports not working for visual studio 2010 PinmemberMember 999911226-Apr-13 7:35 
QuestionGMail SMTP Outgoing Problem PinmemberIshaan Karnik25-Apr-13 3:58 
AnswerRe: GMail SMTP Outgoing Problem PinprofessionalBernhard Hiller26-Apr-13 0:36 
GeneralRe: GMail SMTP Outgoing Problem PinmemberIshaan Karnik30-Apr-13 3:09 
AnswerRe: GMail SMTP Outgoing Problem PinmvpRichard MacCutchan30-Apr-13 6:29 
QuestionGetting Error while transferring records from one database to other using web application [modified] PinmemberParag Raibagkar22-Apr-13 20:13 
AnswerRe: Getting Error while transferring records from one database to other using web application PinmvpSandeep Mewara22-Apr-13 22:43 
QuestionDisplaying data in chart with import csv file to database sql PinmemberDhimas Yuli PW22-Apr-13 16:34 
AnswerRe: Displaying data in chart with import csv file to database sql PinmemberJasmine250123-Apr-13 8:18 
QuestionHelp trying to set a 12 hour cookie for a DHTML popup PinmemberMember 1000506922-Apr-13 5:36 
QuestionCheckbox check should automatically and slowly fadeout to unchecked PinmemberMember 937599314-Apr-13 7:57 
AnswerRe: Checkbox check should automatically and slowly fadeout to unchecked PinmemberMartin-FFB14-Apr-13 23:32 

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

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


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 1 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid