in Education by
How can I get the value of the amp selector and save it in a php variable
1
1
1
<?php $category_id ='"selectedOption"'; // $category_id ='{{selectedOption}}'; // $category_id=remove_special_characters($category_id); $int = (int) filter_var($category_id, FILTER_SANITIZE_NUMBER_INT); echo $int; $filter= get_filter_category($category_id); ?> I tried multiple ways like domdocument but nothing seems to work. Any help would be appreciated $dom = new DOMDocument(); $dom->loadHTML($html); //$num = ""; $optionTags = $dom->getElementsByTagName('div'); print_r($optionTags); for ($i = 0; $i < $optionTags->length; $i++ ) { if ($optionTags->item($i)->hasAttribute('selected') ) { $num = $optionTags->item($i)->nodeValue; } } echo "Num is " . $num; JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Normally you would need this for a form. Hence you will have a submit button or something similar. Way to go here is to link your submit button to another file that reads the selection (possible via POST) and redirects you to the desired page. If you just want to save your selection without doing anything, you could use amp-bind and a JSON Endpoint. The Endpoint gets called when changed, with the selection as parameter and saves it instead of delivering any files what so ever.

Related questions

0 votes
    I am aware that I can use array_unique(array_merge($a,$b)); to merge two arrays and then remove ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I want to load Google fonts in the head-section of my page using a php-function. My -area looks like this: ... ... Now ... I do this, there will be a "1" displayed (because of the...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I want to load Google fonts in the head-section of my page using a php-function. My -area looks like this: ... ... Now ... I do this, there will be a "1" displayed (because of the...
asked May 30, 2022 in Education by JackTerrance
0 votes
    I want to load Google fonts in the head-section of my page using a php-function. My -area looks like this: ... ... Now ... I do this, there will be a "1" displayed (because of the...
asked May 26, 2022 in Education by JackTerrance
0 votes
    Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I want to load Google fonts in the head-section of my page using a php-function. My -area looks like this: ... ... Now ... I do this, there will be a "1" displayed (because of the...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have a script which loops over tables and fields doing a find and replace. The script takes around ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    So this is a zany thing that I'm attempting to do, but what I am trying to achieve is querying ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    So this is a zany thing that I'm attempting to do, but what I am trying to achieve is querying ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    How to solve array problem? $kuponlar = $core->query("SELECT * FROM kupon WHERE kupon_durum = ?", ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    How to solve array problem? $kuponlar = $core->query("SELECT * FROM kupon WHERE kupon_durum = ?", ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    I am struggling to figure out how to specify a MOTO payment with Stripe API and PHP. I believe I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I was recently asked to come up with a script that will allow the end user to upload a PSD ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I was recently asked to come up with a script that will allow the end user to upload a PSD ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
...