wisdominknowledge
New Member
This is my reg.xml:\[code\]<childrens><child_4 entity_id="4" value="http://stackoverflow.com/questions/15681749/Activities" parent_id="2"> <child_10066 entity_id="10066" value="http://stackoverflow.com/questions/15681749/Physical1" parent_id="4"> <child_10067 entity_id="10067" value="http://stackoverflow.com/questions/15681749/Cricket" parent_id="10066"> <child_10068 entity_id="10068" value="http://stackoverflow.com/questions/15681749/One Day" parent_id="10067"/> </child_10067> </child_10066></child_4><child_4331 entity_id="4331" value="http://stackoverflow.com/questions/15681749/Region" parent_id="2"> <child_5069 entity_id="5069" value="http://stackoverflow.com/questions/15681749/Irungattukottai" parent_id="4331"/></child_4331></childrens>\[/code\]This is my \[code\]product.xml\[/code\] file:\[code\]<products> <product_id value="http://stackoverflow.com/questions/15681749/1"> <tab_id value="http://stackoverflow.com/questions/15681749/351"> <tab_name value="http://stackoverflow.com/questions/15681749/test1"/> <region_timezone value="http://stackoverflow.com/questions/15681749/1"/> <registrationstatus value="http://stackoverflow.com/questions/15681749/2"/> <eventstatus value="http://stackoverflow.com/questions/15681749/2"/> <dist_activity value="http://stackoverflow.com/questions/15681749/5"/> <dist_activity value="http://stackoverflow.com/questions/15681749/10068"/> <dist_activity value="http://stackoverflow.com/questions/15681749/10070"/> <dist_region value="http://stackoverflow.com/questions/15681749/5069"/> <dist_region value="http://stackoverflow.com/questions/15681749/5069"/> <dist_region value="http://stackoverflow.com/questions/15681749/5069"/> </tab_id> </product_id> <product_id value="http://stackoverflow.com/questions/15681749/2"> <tab_id value="http://stackoverflow.com/questions/15681749/352"> <tab_name value="http://stackoverflow.com/questions/15681749/test2"/> <region_timezone value="http://stackoverflow.com/questions/15681749/1"/> <registrationstatus value="http://stackoverflow.com/questions/15681749/2"/> <eventstatus value="http://stackoverflow.com/questions/15681749/2"/> <dist_activity value="http://stackoverflow.com/questions/15681749/5"/> <dist_activity value="http://stackoverflow.com/questions/15681749/10069"/> <dist_activity value="http://stackoverflow.com/questions/15681749/10070"/> <dist_region value="http://stackoverflow.com/questions/15681749/4457"/> <dist_region value="http://stackoverflow.com/questions/15681749/7140"/> <dist_region value="http://stackoverflow.com/questions/15681749/5069"/> </tab_id> </product_id></products>\[/code\]This is my try:\[code\]<?php $abc= $_POST['name']; list($first,$second) = explode('in',$abc); $text1[]=$first; $text2[]=$second; foreach($text1 as $event){$event;}foreach($text2 as $region1){$region1;}$r = file_get_contents('reg.xml');$p = file_get_contents('product.xml');$region = simplexml_load_string($r);$product = simplexml_load_string($p);list($entity) = $region->xpath("//*[@value='http://stackoverflow.com/questions/15681749/$event']/@entity_id");$entity=(string)$entity;echo "event:- $event, Region:- $region1, entity:- $entity"; ?>\[/code\]This is my HTML file:\[code\]<html><head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> <script> $(function(){$("#filter").click(function(){ var name = $('#select').val(); alert(name); $.ajax({ type: "POST", data: {"name":name} , url: "array.php", async: false, success: function(result) { alert(result); $("#result").text(result); } }); });}); </script></head><body> <input type="text" id="select"> <input type="button" id="filter" name="button" value="http://stackoverflow.com/questions/15681749/Search"> <div id="result"> </div></body></html>\[/code\]I input this value in the textbox:\[code\]One Day in Irungattukottai\[/code\]
I've tried this code but it's not working and it doesn't give me \[code\]$entity\[/code\].
If I try manually to set \[code\]$event\[/code\] eg:- \[code\]$event\[/code\] =\[code\]"One Day"\[/code\] value then work
So help me out with this, I think my mistake in my \[code\]foreach\[/code\].Thanks.
I've tried this code but it's not working and it doesn't give me \[code\]$entity\[/code\].
If I try manually to set \[code\]$event\[/code\] eg:- \[code\]$event\[/code\] =\[code\]"One Day"\[/code\] value then work
So help me out with this, I think my mistake in my \[code\]foreach\[/code\].Thanks.