Specifing page (inside div) using submit button

Hi,

http://organichs.com/ohsNew/

I have a form on my contact page. when the user fills out the info and clicks on my submit button, I need that page (send_form_email.php)to load inside my div.

this is what I have now -

 <input type="submit" value="Submit" /></td>

I have tried this but it doesn’t work, I get a blank page.

<INPUT TYPE=“button” onClick=“javascript:ajaxpage(‘send_form_email.php’, ‘mainContent’);”>

any help would be appreciated!

Hi,

Using <input type=“submit”> will load the php page in your current window, so the problem would be with your php file.

If you want to load content into a DIV, then you would have to make an httprequest to the php file. In the php file you would have to ECHO whatever content you want displayed. All you need to do then is place your httprequest responsetext in the innerhtml of the target div…

Kinda not-on-topic, but a separate external javascript file using submit() will keep your keyboarding users from getting frustrated trying to submit your form (why? 'cause they and many others hit ENTER to send a form, and not necessarily with the focus on the submit button first either (meaning, people don’t always hit TAB after the last input before hitting ENTER)).

Good call Stomme poes, use the forms submit event.

been readin’ chris heilmann 'bout 'cessabillty… that and i tend to keyboard thru forms anywayz

Me too. I hate having to use the mouse to click a silly submit button when I can just hit the enter key. It’s disappointing how many websites fail to account for this, and have broken forms.

Thanks for the replies. I will try them and report back. Instinctively, I always hit enter as well, then when that doesn’t work, I press the button.