A step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.
A C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.
This tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.
Creating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.
How to create an AJAX contact formThis tutorial shows users how to create an AJAX contact form. The form method in this tutorial is set to POST. |
On Wednesday, May 3rd 2006 at 03:30 PM By Nabeel Akhtar (View Profile) ![]() ![]() ![]() ![]() (Rated 4.1 with 14 votes) |
||
|
Before we begin the tutorial, view the AJAX Contact Form in action. The AJAX Contact Form uses the POST method to transfer the data from the form to the PHP file. From thereon you can store the data in variables using "$_POST". This is also illustrated in the code. There are two pages that you will need. The first page will show the form to the user when the user first visits the page. We will call this page "Form.php". The other page will process the data from the first page and will return a confirmation message. You can use PHP or any other language to do anything you want. We are going to call the second page "Process.php". To get started, first create a form: ![]() There are two <span> sections defined in this page. The first one is highlighted in orange in the above image and the second span is the table that holds the input fields. The status span will display the status of the form while it is being processed. Once all the information has been processed, the status will read "Ready". Following is the code for the Form.php file:
Following is the code for the "Process.php" file:
More Tutorials at NabeelAkhtar.NET |
|||
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|||
|
|||
Current Commentsveary nice, do u know that with ajax u can save veary much of your bandwitch
Well it depends what you are doing with AJAX... For example the auto-refresh pages end up using more bandwidth... If pages are refreshed at even a higher rate, the page will just eat up your bandwidth.
It is indeed a very nice example, but there is one thing that should also be mentoined.
When you insert text that is none english like the french é, ç, à, è then you get weird results if you save your form output in to a database (when you don't save that as utf-8). Displaying it in on a page (with echo) doesn't reveal this but if you look at your decoded url data (http header) then you'll see that the text was encoded in utf-8. This is absolutely normal because the xmlhttprequest object always sends this encoded data as utf-8.
So when you save characters like é, ç, à you get the following results in your database (column collation is in latin1):
é => é
This is not expected because when you want to search for a field that contains this character you will get no results because the database doesn't see this character as é.
Displaying it on a webpage with you header set to iso-8859-1 is no problem, but your data is saved wrongfully.
To avoid this you should always save data in utf-8, but the bigest problem is that php internally doesn't support utf-8 and then you loose the ability to perform string functions on the requested data. There are librarys and functions out there to perform these string functions on utf8 data but they require extra process time (greater script execution time) and extra coding.
I wanted to write this because it's important to see all the aspects of using ajax with php.
I also posted a topic on this on the phparch website.
You can view the topic by following this url: http://www.phparch.com/discuss/index.php?t=msg&th=4203
At <a href="http://www.ajaxlines.com">Ajaxlines</a> you can find a full list of Ajax tutorials, services and presentations.
At Ajaxlines you can find a full list of Ajax tutorials, services and presentations.
I think you have to visit it now ... http://www.ajaxlines.com
No security
rtrter
<a href="http://www.digitalcamerainfo.com/bbs/member.php?u=1860">buy viagra online</a><br><a href="http://www.dealdatabase.com/forum/member.php?u=68538">Buy levitra</a><br><a href="http://www.gamecareerguide.com/forums/member.php?u=2520">buy cialis online</a><br><a href="http://extjs.com/forum/member.php?u=24461">buy cialis</a><br><a href="http://extjs.com/forum/member.php?u=24461?generic+cialis">generic cialis</a><br><a href="http://www.gamecareerguide.com/forums/member.php?u=2478">cheap cialis</a><br><a href="http://forum.springframework.org/member.php?u=34111">generic viagra</a><br><a href="http://www.layersmagazine.com/forum/member.php?u=4276">buy viagra</a><br><a href="http://forum.springframework.org/member.php?u=34111?cheap+viagra">cheap viagra</a><br><a href="http://ringtones.forum5.com">download free ringtones</a><br><a href="http://forum.springframework.org/member.php?u=34397">buy valium</a><br><a href="http://forum.springframework.org/member.php?u=34397?buy+valium+online">buy valium online</a><br><a href="http://forums.ipodhacks.com/member.php?u=35372">buy tramadol</a><br><a href="http://forums.ipodhacks.com/member.php?u=35372?cheap+tramadol">cheap tramadol</a><br><a href="http://forums.ipodhacks.com/member.php?u=35372?buy+tramadol+online">buy tramadol online</a><br><a href="http://www.layersmagazine.com/forum/member.php?u=4313">replica watch</a>
This shit only works in UTF-8! Fuck!
Well, actually I manage to make this works with those special characters, Even I use this for sending a mail it quite works.
look at the form here!! www.dmpardo.com
By the way. If you have any inqueries email me!
Hi, i tried your example and it works, but if i put instead of email input, a select with the same name/id it doesn't work, the $_POST['email2'] or $_POST['email'] are BLANK, why ? :|
jjjj
Re: tutorial/28.php
Form.php is just HTML and should be called Form.html.
It fails validation by HTMLTidy.
Suggest removing table layout to simplify, it isn't needed for a demo.
But that's all minor - this demo was exactly what I wanted and took some hunting. I like that it's bare, and doesn't advertise any Ajax or PHP framework, just gives raw code.
Hello sir my name is sanjay kumar i am currently operation http://www.moneyinhands.com i don't idea about how i create php form for my website with spam protection. Current i am using php form from emailmeform.com but i need my own php form code. Please tell me or suggest me how i create php form to i use for my all website. I am waiting for kind suggestions...
dfdfdfdfd
Seo /Increase leads/traffic/Link Building/ Web site Development
Hi Website Administrator,
Have you ever searched your company’s website with different keywords related to your business? On which page does it appears?
We can place your website on top 10 of the Natural Listings on Google, Yahoo and MSN. Our Search Engine Optimization team delivers more top rankings then anyone else and we can prove it. We do not use "link farms" or "black hat" methods that Google and the other search engines frown upon and can use to de-list or ban your site. The techniques are proprietary, involving some valuable closely held trade secrets. Our prices are less then half of what other companies charge.
We would be happy to send you a proposal using the top search phrases for your area of expertise. Please contact me at your convenience so we can start saving you some money.
Sincerely,
Jake Carner
Marketing Manager
Professional Lists, Inc.
www.seo-links-building.co.in
jake.ibs11@gmail.com
Nice manual, thank you. As I know AjaX keeps in touch with php form. You may know more about it with php form.
http://phpforms.net/tutorial/html-basics/php-forms.html
hiiiiiiii
Well, it was 2 years ago, but I did my AJAX form with UTF-8 great support for cyrilic with this tool: http://en.dklab.ru/lib/JsHttpRequest/
Related Tutorials
Related Source Code
PHP Job Search