Styling PHP very proving difficult



I have a form where a user will type in there Reference Number to check the status of their in enquiry:


Example: A user will navigate to this webpage: http://ift.tt/1uZj9nU


They then type in their Reference: "1" or "2" , "3" etc...whatever number they were allocated which then displays a brief record.


but i'm unable to format the data that is displayed. I wish to have the reference number a diferrent colour, wish to create line breaks, underline emails addresses. but i'm unsure how to do this with my current .php code:



<?php
$q=$_GET["q"];

$xmlDoc = new DOMDocument();
$xmlDoc->load("cd_catalog.xml");

$x=$xmlDoc->getElementsByTagName('Reference');

for ($i=0; $i<=$x->length-1; $i++) {
//Process only element nodes
if ($x->item($i)->nodeType==1) {
if ($x->item($i)->childNodes->item(0)->nodeValue == $q) {
$y=($x->item($i)->parentNode);
}
}
}

$cd=($y->childNodes);

for ($i=0;$i<$cd->length;$i++) {
//Process only element nodes
if ($cd->item($i)->nodeType==1) {
echo("<b>" . $cd->item($i)->nodeName . ":</b> ");
echo($cd->item($i)->childNodes->item(0)->nodeValue);
echo("<br>");
}
}
?>


The fields from this currently code display:


Reporter: Test1 REFERENCE: 1 Submission: 2014-11-08T00:00:00 Status: Pending Officer: Name1 Email: test@email.com Telephone: 0113 1234


Also i'm notsure why REFERENCE is UPPERCASE either I know we have to your attribute but i'm unsure on how to apply them to the php code as i dont know how to reference each individual field.


No comments:

Post a Comment