<?php
$number 	= $_POST['number'];
$url 		= $_POST['url'];
$name 		=  $_POST['name'];

$nb = 1;

$xmla = simplexml_load_file('../db/blog_links.xml');

$test = $xmla->note;

$field_count = count($test);

for($i=0;$i<$field_count;$i++){
	if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1;
}

$newnote = $xmla->addChild('link');
$newnote->addChild('name', $name);
$newnote->addChild('number', $number);
$newnote->addChild('url', $url);
$xmla->asXML('../db/blog_links.xml');

echo $nb;