I have a global array variable that I store some values with the $ _ POST
variable I'm using for Because I am modifying them within the if
statement I have used the term global
I already have the array in the array (0,1)
in view of the values that have been modified within my if
details, then I still get the initial value with which I started.
Edit:
This is my formHandler.php
code:
/ Get / form ID $ formID = $ _GET ['id']; // to create a global array $ results = array (); // Check to check if the ID has been retrieved ($ formID == 1) {$ value = $ _POST ['spirit']; $ Result [0] = $ value; // 302 reader header ("location: page 02.php? Result1 = $ result [0]"); } And if ($ formID == 2) {$ value = $ _POST ['emotion02']; $ Result [1] = $ value; // 302 reader header ("location: page 03.php? And result 2 = $ result [1]"); }
This is my page01.php
code:
& lt; H1 & gt; This page is 01 & lt; / H1> & Lt; Form id = "form" action = "formHandler.php? Id = 1" method = "post" & gt; & Lt; P & gt; & Lt; Input type = "radio" value = "happy" name = "spirit" & gt; Happy & lt; Input type = "radio" value = "excited" name = "emotion" & gt; Excite & lt; Input type "radio" value = "angry" name = "emotion" & gt; Angry & lt; Input type = "radio" value = "disappointed" name = "emotion" & gt; Disappointed & lt; Input type = "radio" value = "unhappy" name "=" emotion "& gt; annoying & lt; input type =" radio "value =" sad thing "name =" emotion "> depression; input type = "Radio" value = "tired" name = "emotion" & gt; tired & lt; input type = "radio" value = "cool" name = "emotion" & gt; angry & lt; / p & gt; & Lt; p & gt; Input Type = "submit" name = "submit" value = "submit">
This is my page02.php
code:
> this page is 02
Here is my page03.php
code:
& lt ;? php included ("formHandler.php");? & Gt ; & Lt; html & gt; & lt; top & gt; & gt; Title & gt; Audio Survey & lt; / title & gt; & lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Thank you for your submission & lt; / H1> & Lt ;? Php $ result = array (); $ Result [0] = $ _GET ['results1']; $ Result [1] = $ _GET ['results2']; Echo "& lt; p & gt;" . $ Result [0] "" $ result [1] "& lt; / p & gt;"; ? & Gt; & Lt; / Body & gt; & Lt; / Html & gt;
You are using $ _GET to get the form ID but you have Said that this is $ _POST (method = "POST") form, so the ID will not match the condition on your statements. It should fix this:
$ formID = $ _POST ['id'];
In addition, to pass the ID as $ _POST should have an input on the form, the actual id attribute of the form will not be sent to the server itself.
If you are actually passing "id = x" on the url from the ARM attribute, please also post the HTML in the form.
And the other thing, you do not need to, and should not use "Global", especially if they are in the same file where you are calling them.
Comments
Post a Comment