Jump to content

[SOLVED] Another Newbie question (Probably dumb)


colinsp

Recommended Posts

Is it possible to get the value of an HTML input box on a form and assign it to a php variable without having a submit button on the form? Something like an after update? Or is this something that would have to be done in Javascript / Ajax etc.

 

Sorry if this is a dumb question but I am trying to learn PHP by setting myself some challenges.

Well you need to remember that the form and data entered is client side (until its posted) and php is server side!..

 

So i would normally say yes via ajax BUT it the real question is what do you want to do ?

if you wish to run any PHP code without reloading the page then ajax is probably what you want.

Well, if you wanted to achieve this without loading the page, then yes, you'd have to use ajax.

 

However, if you simply wanted a form without a submit button, you could use javascript to submit the forum once a user changes something. For example, something like onkeyup="parentNode.submit()"

 

Something like that anyway.

Thanks for your responses.

 

I think that Ajax is a step too far for me at the moment I will make do with a submit button for now.

 

I will look into Ajax in the coming months to see how to do it.

 

Basically what I have is an input field that has its options populated from a query on a mysql database. When a user selects the option I want to perform a query on a second table and the result of this query is populated below it in a table as there will be multiple rows that match the selection.

 

Any way thanks for your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.