Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Display error message
Old 02-04-2006, 06:10 AM Display error message
herbal_ali's Avatar
Extreme Talker

Posts: 156
Location: London, UK
Trades: 0
i've created a login page for my site here

However, I would like to display an error message when somebody enters incorrect information. I don't mean a popup, just text displayed in a specific area. How would i do this?

Incase you need to know, i use DW MX 2004 and my shopping cart script is Oscommerce.

Thankyou

EDIT: here's the source code
herbal_ali is offline
Reply With Quote
View Public Profile Visit herbal_ali's homepage!
 
 
Register now for full access!
Old 02-04-2006, 09:32 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
it depends how you're submitting your form. i use self submission and this is the code :

PHP Code:
          <?php 
if(isset($submit))
{  echo
"<style type='text/css'>#normalBold {color:red;}</style>";}  
     
$name $_POST["name"];
     
$bob='0';
     
$error_name=''
     
if(
trim($name)    =='' || strlen(trim($name))    <|| strlen(trim($name))>30){  $error_name.="Name:";         $bob='1'; } 

 if (
$bob== "1"){ echo' show your form here ';}
else               {echo
' allow user to proceed';}
?>
This will check to see if $name is a valid value, if it is: $error_name doesnt hold a value and $bob is eqaul to 0 so the user is allowed to enter your site. If $name isnt a valid value $bob is equal to 1 and the user sees the form again along with $error_name which now holds a value and will become visable.

Hope that helps
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 02-04-2006, 03:30 PM
herbal_ali's Avatar
Extreme Talker

Posts: 156
Location: London, UK
Trades: 0
Thankyou, it works fine. However it's not being displayed in bold red font like i want it to be. How do i change the font to one of the styles i have on a stylesheet???
herbal_ali is offline
Reply With Quote
View Public Profile Visit herbal_ali's homepage!
 
Old 02-05-2006, 02:02 PM Re: Display error message
herbal_ali's Avatar
Extreme Talker

Posts: 156
Location: London, UK
Trades: 0
nobody knows
herbal_ali is offline
Reply With Quote
View Public Profile Visit herbal_ali's homepage!
 
Old 02-05-2006, 02:24 PM Re: Display error message
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
{ echo"<style type='text/css'>#normalBold {color:red;}</style>";}

If the form has been submitted css id #normalBold will be changed from whatever colour it is set to on the style sheet to red. Only if the form has been submitted though. Simply change normalBold to the relevant css id.
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Display error message
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20948 seconds with 12 queries