which button was clicked?
in my job, similar tasks seem to repeat themselves every few months. this perhaps partially explains a geometrically (?) declining quantity of posts to this web log.
i have two web pages which use the same processing file. both pages include forms with "submit" buttons. running on my local machine, the processing file would check which button was clicked to determine which of the two pages the post originated from. the file would check if the posted button variable were null or not:
if (!is_null($_POST['button_1'])){
...
}
else if (!is_null($_POST['button_2'])){
...
}
on the production server, this does not work. my solution was to create a hidden variable in addition to the submit button in the web page:
input name="track" type="hidden" value="true">
input name="button_1" type="submit" value="track">
the process file then checks to see if this posted variable is null or not. why the processing page can handle a null hidden variable but not a null submit variable, i do not understand.
i have two web pages which use the same processing file. both pages include forms with "submit" buttons. running on my local machine, the processing file would check which button was clicked to determine which of the two pages the post originated from. the file would check if the posted button variable were null or not:
if (!is_null($_POST['button_1'])){
...
}
else if (!is_null($_POST['button_2'])){
...
}
on the production server, this does not work. my solution was to create a hidden variable in addition to the submit button in the web page:
input name="track" type="hidden" value="true">
input name="button_1" type="submit" value="track">
the process file then checks to see if this posted variable is null or not. why the processing page can handle a null hidden variable but not a null submit variable, i do not understand.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home