Hello to everyone.Sorry if the question has been already made, but is like i need to waste 1 day to find what i'm lookin for so if someone could tell me please how to pass data from ajax to a php page in resonable way(meaning that i don't need to code a single string in some strange way then to decode it.) i will thank him very much.
I have some inputs, radio ecc with names and when i pass them to php with ajax/js i would like to know how that data belongs to, without encoding and decoding if that is possible.
Regardes to everyone(i'm not english)

Recommended Answers

All 3 Replies

make sure all your inputs have ids as well as names:
eg: <input name=foo id=foo>
recommend you use jquery so you can simply serialize the values for posting
eg

var myformdata=$("#myformid").serialize();

Thanks for the reply.

I definitely wasn't clear enough, my problem isn't making a string like "username=xirian&age=23&hobbies=coding" to send to the php page(even if i can't use &, don't know why).
My problem is that i don't know how to read the string on php so i can put the data in a mysql databse.

Resolved by vsmash, my mistake.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.