prakash Posted November 22, 2007 Share Posted November 22, 2007 I am little bit confused on using variable directly under $_POST to defile another POST variable so how can extract the value of $test? currently $test outputs blank value <?php $test1=$arrayvalue[$i]; $test=$_POST[$test1]; print $test; ?> Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/ Share on other sites More sharing options...
wildteen88 Posted November 22, 2007 Share Posted November 22, 2007 Where does $arrayvalue[$i] get set/come from? Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-396995 Share on other sites More sharing options...
cooldude832 Posted November 22, 2007 Share Posted November 22, 2007 $_POST is a defined superglobal containing all if set variables defined via the http method of POST. You can't redefine them in your script you can extract their values 1 of two ways A as an associtive array or B as an indexed array. For most cases associtive is the proper method i.e $_POST['varkey']; Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-396998 Share on other sites More sharing options...
prakash Posted November 22, 2007 Author Share Posted November 22, 2007 it gets value from the form which is in a array form $arrayvalue=$_POST["myfield"]; Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-397003 Share on other sites More sharing options...
prakash Posted November 22, 2007 Author Share Posted November 22, 2007 the actual code is <?php $arrayvalue=$_POST["myfield"]; for ($i=0;$i<count($arrayvalue);$i++) { $test1=$arrayvalue[$i]; $test=$_POST[$test1]; print $test; } ?> Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-397005 Share on other sites More sharing options...
wildteen88 Posted November 22, 2007 Share Posted November 22, 2007 Ahh I see... You'll want to use $test1 = $_POST[$arrayvalue[$i]] Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-397006 Share on other sites More sharing options...
prakash Posted November 22, 2007 Author Share Posted November 22, 2007 Ahh I see... You'll want to use $test1 = $_POST[$arrayvalue[$i]] yes but it's not working Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-397010 Share on other sites More sharing options...
prakash Posted November 22, 2007 Author Share Posted November 22, 2007 sorry there was some mistakes on the code. it have been solved Link to comment https://forums.phpfreaks.com/topic/78453-solved-_post-method-help/#findComment-397032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.