Generating HTML with PHP without refreshing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
massimorai
Forum Newbie
Posts: 13
Joined: Mon Feb 06, 2012 8:01 am

Generating HTML with PHP without refreshing

Post by massimorai »

Hello All,

I just joined the site today, looking for some guidance here as I am a newbie. My experience is limited as I started learning PHP about 2 months ago, so I apologize if this question is considered "dumb".

I am making a webpage, and I want to be able to click on the links and have them display in a specific area of the site without having to refresh the page.

Thoughts?

Massimo
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Generating HTML with PHP without refreshing

Post by Celauran »

PHP runs server-side, so trying to do anything in PHP without a page refresh isn't going to work. Sounds like you'll probably want an AJAX solution. Could you expand a little on what you're trying to do?
massimorai
Forum Newbie
Posts: 13
Joined: Mon Feb 06, 2012 8:01 am

Re: Generating HTML with PHP without refreshing

Post by massimorai »

Celauran, thank you so much for the response.

I would like to create a dynamic form. One that changes depending on which options are selected. I am creating an "intake form" that captures specific project related information however the form itself needs to be dynamic...
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Generating HTML with PHP without refreshing

Post by Celauran »

The same principle applies. Have listeners for onchange/onkeyup (or whatever applies) on your form fields, and send an AJAX request to get the appropriate values for the dependent fields.
massimorai
Forum Newbie
Posts: 13
Joined: Mon Feb 06, 2012 8:01 am

Re: Generating HTML with PHP without refreshing

Post by massimorai »

And once the form is "submitted" the contents can be retrieved through the GET and POST methods correct?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Generating HTML with PHP without refreshing

Post by Celauran »

Yes, that's right.
massimorai
Forum Newbie
Posts: 13
Joined: Mon Feb 06, 2012 8:01 am

Re: Generating HTML with PHP without refreshing

Post by massimorai »

Thanks ! :-)
Post Reply