Page 1 of 1

Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 8:32 am
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

Re: Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 8:58 am
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?

Re: Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 3:34 pm
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...

Re: Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 3:43 pm
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.

Re: Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 8:13 pm
by massimorai
And once the form is "submitted" the contents can be retrieved through the GET and POST methods correct?

Re: Generating HTML with PHP without refreshing

Posted: Mon Feb 06, 2012 8:24 pm
by Celauran
Yes, that's right.

Re: Generating HTML with PHP without refreshing

Posted: Tue Feb 07, 2012 8:08 pm
by massimorai
Thanks ! :-)