4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP/JS integration problems
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
metsfan922
Junior WebHelper
Junior WebHelper


Joined: 09 May 2002
Posts: 15

PostPosted: Fri May 10, 2002 3:48 pm (21 years, 11 months ago) Reply with QuoteBack to Top

i declare two text boxes text1 and text2 and use them for form validation in JS, in a .php file. however, on the next page when i try to use text1 and text2 in php, it seems taht since i used them in javascript, i cannot use them in the next page which is in php. why cant i use the same variables for JS and PHP? if i can, why am i getting errors?
OfflineView User's ProfileFind all posts by metsfan922Send Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Fri May 10, 2002 3:58 pm (21 years, 11 months ago) Reply with QuoteBack to Top

Javascript is CLIENT side, and PHP is SERVER side. The two do not interact with each other unless special measures are taken.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
metsfan922
Junior WebHelper
Junior WebHelper


Joined: 09 May 2002
Posts: 15

PostPosted: Fri May 10, 2002 8:33 pm (21 years, 11 months ago) Reply with QuoteBack to Top

unless u know a way to do form validation with php, how do u do that?
OfflineView User's ProfileFind all posts by metsfan922Send Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Fri May 10, 2002 9:32 pm (21 years, 11 months ago) Reply with QuoteBack to Top

Depends what you want to validate.

If its just that the field has been filled in you can use, something like:

Code:
if(empty($field)) {
    //field is empty, give error message
} else {
    //process form e.g. email it or add it to db
}

You can also use regular expresions to check the field contains certain data e.g that a phone number contains numbers.
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
metsfan922
Junior WebHelper
Junior WebHelper


Joined: 09 May 2002
Posts: 15

PostPosted: Sat May 18, 2002 4:31 am (21 years, 11 months ago) Reply with QuoteBack to Top

we are not all php mongers here. i am a mere amature. that long chain of slashes and letters and numbers have no meaning to me. if ur gonna post something on a help board, u have to newbify it
OfflineView User's ProfileFind all posts by metsfan922Send Personal Message
php4ever
Junior WebHelper
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49

PostPosted: Sat May 18, 2002 5:01 pm (21 years, 11 months ago) Reply with QuoteBack to Top

is an example of a regular expression. I realize now that this chain of characters may look a bit overwhelming to newbies but once you understand how to compose one, you will find that it can be helpful whether you choose to code in PHP, Perl or JavaScript. In this particular case, the regular expression does as I describe in the comment above it. If you need to learn how to create or interpret a regular expression, I suggest that you may wish to review Chapter 8, "Regular Expressions" IN: PHP for the World Wide Web by Larry Ullman (Visual Quickstart Guide), Peachpit Press, 2001.
OfflineView User's ProfileFind all posts by php4everSend Personal Message
Peter
Team Member



Joined: 09 Jan 2002
Posts: 147
Location: UK

PostPosted: Sat May 18, 2002 8:35 pm (21 years, 11 months ago) Reply with QuoteBack to Top

metsfan922 wrote:
we are not all php mongers here. i am a mere amature. that long chain of slashes and letters and numbers have no meaning to me. if ur gonna post something on a help board, u have to newbify it

If you want to learn you have to make some effort. We are here to help you, not to teach you. Buy yourself a book and spend time teaching yourself. Then ask questions when you get stuck.

That chain of slashes and letters is a regular expression. If you want to really understand them then buy the book "Mastering Regular Expressions" which tells you absolutely everything you need to know.

________________________________
Maple Design - quality web design and custom programming
OfflineView User's ProfileFind all posts by PeterSend Personal MessageVisit Poster's WebsiteYahoo MessengerICQ Number
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun May 19, 2002 7:59 am (21 years, 11 months ago) Reply with QuoteBack to Top

Or read the article mentioned here:

http://www.4webhelp.net/forums/viewtopic.php?p=4339#4339

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.215841 seconds :: 21 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme