
03-28-06, 05:01 PM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
verify form fields.
so i did, i swear i went to the search section and did form validation. my answer was not there.
as you will see it is a fairly long contact us form. i want to verify that the "name" "email" and the "phone" fields have been filled. if someone would be willing to help it would be great. i can write it in java but i would rather just have it all written on one page in the php. any thoughts? i have incldued my source code and my php code.
here is my source code
my php code is this
|

03-29-06, 02:14 AM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
Oh, and it's javascript, not java! 
|

03-29-06, 04:07 AM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
And another thing. You don't have to use isset() every time. Once the form is submitted and the field exists it couts as "isset", even of the field is empty. You could use this instead.
|

03-29-06, 09:47 AM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thankx nico_swd
you rockx! 
|

03-29-06, 02:03 PM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by nico_swd
And another thing. You don't have to use isset() every time. Once the form is submitted and the field exists it couts as "isset", even of the field is empty. You could use this instead.
|
nico or others here is antother two questions for you. very simple i am sure.
the output instead of it looking like this.
name: name
i want
name name
how is that done?
also when i try to
i get errors.
any ideas?
thankx for the help
|

03-29-06, 02:05 PM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
nico sorry i thought of the last thing i wanted to ask.
with the verifing, if something doesnt match up what is the best way to send the user back to the page to finish filling things out?
|

03-29-06, 02:48 PM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
Untested but should work.
Place the PHP code on the same site where the form is. You may have to change the extension to .php if necessary. Place the code before any HTML starts, before the <html> tag. Now does it keep the visitor on the site when it detects empty fields and shows the errors below the "About?". You will see this code:
You may want to move it if you want the errors to be shown somewhere else.
Oh, and it's easier to work with logical post names. Meaning, for example "$_POST["name"]" instead of "$_POST["y0"]". 
|

03-30-06, 11:19 AM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

03-30-06, 03:01 PM
|
 |
Community Liaison
|
|
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
|
|
Quote:
|
Originally Posted by pkcidstudio
nico or others here is antother two questions for you. very simple i am sure.
the output instead of it looking like this.
name: name
i want
name name
how is that done?
also when i try to
i get errors.
any ideas?
thankx for the help
|
you want to display text in bold? use this:
what errors do you get?
Greetz,
UnrealEd
*edit: i just saw nico allready solved the problem 
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
|

05-15-06, 05:35 PM
|
 |
Coding Addict
|
|
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
nico,
perhaps you or someone else might have the answer to this.
with this code
i am getting no love with the header. it is preforming th everify, but as far as the header goes it isnt doing anything just remaining on same page. anythoughts?
Last edited by pkcidstudio; 05-15-06 at 05:38 PM.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|