hi, am new to php and xml. i want to know how to make a search using the xml

this is the xml file:

<?xml version="1.0"?>
<students>
<student>
<id>001</id>
<name>shaan</name>
</student>
<student><id>002</id><name>shaany</name></student><student><id>002</id><name>shaany</name></student><student><id>003</id><name>alisha</name></student><student><id>003</id><name>alisha</name></student><student><id>004</id><name>ayesha</name></student></students>

this is the php code

<?php

$s_name= $_POST['name'];

$xml = simplexml_load_file("mydata.xml");

foreach($root->student->$s_name as $s_name)
{
echo "<p>";
echo "<strong>Name:</strong> ".$s_student->name."<br/>";
echo "<strong>Id:</strong> ".$s_student->id."<br/>";
echo "</p>";
}