PDA

View Full Version : PHP Forms and Dreamweaver


Ricky55
11-07-2008, 09:49 AM
Hi

I'm doing a web page for a client at the moment where the contact us page contains two separate forms, one for email and one that sends an SMS Text.

In the past I have just used a really basic script for my forms but this script only seems to send emails to the domain in which its hosted.

Any way this has lead me to start looking into PHP a bit and scripts but I'm finding that most scripts have their own form validation built in.

This is probably a good thing but it just looks ugly when the user clicks the submit button I don't want them to be taken to a blank page that reads and error and then have to click the browser back button to correct the form.

It may not be as good in terms of security but I prefer the way Dreamweaver handles form validation in that that little error box appears stating what the user needs to do to correct the form.

So my questions are:
Is this Dreamweaver form validation OK to use or should I be using validation wrote into the code of the PHP script?

Also, if it is better to use the validation in the PHP script is there a way of making the errors appear more like Dreamweaver does?

And finally, can any one point me towards a decent PHP send mail script?

davidj
11-07-2008, 12:48 PM
fancy a lesson or two?


Is this Dreamweaver form validation OK to use or should I be using validation wrote into the code of the PHP script?

I normally use both to verify forms. The reason being is that the majority will be caught at the javascript point and this saves a server request. The few remaining that don't have JS switched on is then caught by the PHP script.

Also, if it is better to use the validation in the PHP script is there a way of making the errors appear more like Dreamweaver does?

you can style an error to look any way you like. It has nothing to do with PHP or Dreamweaver

And finally, can any one point me towards a decent PHP send mail script
there is one on this site under the tutorial section i think

Ricky55
11-07-2008, 01:55 PM
Thanks David.

How would you get the PHP script make dialogue boxes appear like the client side validation of Dreamweaver? Would this be easy to do?

davidj
11-07-2008, 08:33 PM
remember that PHP only evaluates logic and returns HTML

you can therefore return the HTML of you own

contact me through messenger for more info

Ricky55
11-09-2008, 03:07 AM
Via a few tutorials and I'm managed to write a basic script that works.

I am using the Spry Client Side validation built into Dreamweaver which I'm happy with but as you said David you use both, Client and Server side, how does this work? Do they clash because the both check when the Submit button is clicked.

Or do you get PHP to check for different things / in more detail how does this work?

Could you please just expand on this a bit further.

Ricky55
11-09-2008, 03:09 AM
Ps I might take you up on a bit of private training, just bought a book on PHP getting quite interested in it. I don't like to held back by not knowing something.

davidj
11-09-2008, 09:33 AM
Client and Server side, how does this work? Do they clash because the both check when the Submit button is clicked.
Javascript is run and interpreted from your browser. This is Client side. There is no server interaction at this point.

When you submit a form and the server detects a php extension it hands the request over to the php engine which processes all the php before returning just HTML.

the method of using both is to check the form on submit. This is not really submitting the form. What your doing is clicking a 'button' which may have submit text as a value. The button fires a validation JS function which checks the fields and validates the form. If the form validates through JS its the JS function which submits the form, passing it over to the PHP engine. If the JS function detects an invalid form it bypasses the submit command invoking your error handling.

Ricky55
11-10-2008, 07:31 PM
Cheers man.