getting variable before submitting the form
Moderator: General Moderators
getting variable before submitting the form
Hello forum,
I need to get a varibale in a form before submitting the form? is it possible? or is there any other way I can implement it.
Sai Krishna
I need to get a varibale in a form before submitting the form? is it possible? or is there any other way I can implement it.
Sai Krishna
its very possible that you do not need to get the variable beore submitting the form. please post your scenario.
however, with javascript, you could.
however, with javascript, you could.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
why would you need to check it before submitting the form? using a simple query, with an if/else can tell you if stock is available, then you can do what you need to do based on that 
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
I've seen this sort of thing done with javascript and frames before, you have a hidden form in a frame on the page that submits the data via js to a php page which executes the query and then returns the result via js to the main page. It is a really hideous way to do it tho.
I would probably do it all in php and have the form action page check the stock levels and use a redirect back to the form if there are any probs, you can keep the contents of the form in a session var and fill out all the details from it.
I would probably do it all in php and have the form action page check the stock levels and use a redirect back to the form if there are any probs, you can keep the contents of the form in a session var and fill out all the details from it.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
You could get all the stock levels and place them in a Javascript array when initially loading the page for a "quick check" via Javascript. You still need to check the stock level however when the form is submitted. No matter what you do/How you do it this check is necessary as the submitting of the form is the user saying "Yes I want to do this". Also this provides a check when Javascript is disabled.
Rather than use IFrames or frames I would check out this link as it describes a method called HTTPRequest. [url=viewtopic.php?t=34665[/url]
Rather than use IFrames or frames I would check out this link as it describes a method called HTTPRequest. [url=viewtopic.php?t=34665[/url]
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Don't have the time at present but similar things are around if you look. E.g http://forums.devnetwork.net/viewtopic.php?t=29084
Hi
In the following url,
viewtopic.php?t=34665
In the updateIt() function
in the place of
can I open a file which exists but I dont want to load the file on to the borwser and still execte the php file,
Also how to pass numerous variables
when Im passing various variables to it I get an error in Javascript console saying
where the actual code is as follows
In the following url,
viewtopic.php?t=34665
In the updateIt() function
in the place of
Code: Select all
reqsend.open("POST", "online.php", true);Also how to pass numerous variables
Code: Select all
var stuff = "upd=1&who=<?=$_SESSION['loggedinid'];?>"Code: Select all
var variables="country=<?$country?>&kit_code=<br />Code: Select all
var variables="country=<?$country?> &kit_code=<?$item_code?>&stock_type=<?$stock_type?>";