Hello all, I am trying to create an interface that will allow someone other than myself to update an xml file which stores company contact info. I have the xml getting pulled in to another page which runs the google maps api to create markers, windows, etc. I would like to append rather than create new every time.
I've been reading up on w3c and browsing tutorials for a few days, but I'm sort of new to this (both php and javascript which I had to use for the google api), so please forgive my ignorance. I'm probably going to have to adjust my xml structure as right now all the address information is stored in a CDATA section. I know how to parse the xml to display it if I were to change the address info to attributes or even child elements, however if there is a simple way to not do this, it would keep me from having to change my js to get the map working.
My xml structure is basically like this:
Code:
<markers>
<marker lat="45.4654521" lng="99.9999" company="McDonalds">
<infowindow>
<[CDATA [
<h1>McDonalds</h1><br />
123 Street Ave<br />
City, ST 99999<br />
<a href="www.google.com">google!</a>
]]>
</infowindow>
</marker>
</markers>
My php script to parse and display the company name of existing entries:
Code:
<?php
$xml = simplexml_load_file("rp2.xml");
foreach($xml->marker as $marker)
{
echo "<table>
<tr>
<td width='10%' class='tdnavtitle'>" . $marker['company'] . "</td></tr>
</table>";
}
?>
And my form, which I know is missing an onsubmit() and the action is blank (missing because I don't know what to do at this point):
Code:
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="1">
<tr>
<td colspan="2" bgcolor="#CCCCCC">Contacts Info Input Form</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td width="12%"><strong>Company Name:</strong></td>
<td width="88%"><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td width="12%"><strong>Street Address:</strong></td>
<td width="88%"><label>
<input name="name" type="text" id="street" />
</label></td>
</tr>
<tr>
<td width="12%"><strong>City:</strong></td>
<td width="88%"><label>
<input name="name" type="text" id="city" />
</label></td>
</tr>
</table>
</form>
I guess what I am looking for is:
How do I append my xml file from the php script, when the user has put data in the required fields, and clicks submit? Any help would be very appreciated.