Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a HTML for to add to an existing XML file.

Status
Not open for further replies.

spodo

Technical User
Sep 13, 2005
1
0
0
IE
Hello,

The following question is probably a horrible betreyal of by ineptness.

I would like to find a way to add to an existing XML file using the user-inputted information in HTML text fields and submitted as a form.

The text information has to be incorporated into the xml during the process also.

e.g:

Using the following html to add a new item to an RSS feed:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<title>RSS Feed Updater.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<p>The Blocker Refuge RSS Feed. </p>
<form action="" method="post" name="form1" id="form1" onsubmit="">
<p>Name:
<input name="Name" type="text" size="57" />
</p>
<p>Job:
<input name="Job" type="text" size="50" />
</p>
<p>Homepage:
<input name="homepage" type="text" size="75" />
</p>
<input type="submit" name="Submit" value="Submit" />
</form>
<p>&nbsp;</p>

<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

The string [name << " - " << occupation] would form the title and the homepage string the link.

Basically I'm trying to make an open RSS feed.


Any suggestions?
 
What happens if you have the hello world example as whitelist_editor.cgi? If that works, try and narrow down the code to see where the error is occurring

Jon

"I don't regret this, but I both rue and lament it.
 
I can't do this anymore. I'm getting nowhere completely.

As I have said before, I want to give the form, the script, and the xml file to someone who knows what their doing and who can run it, as I would, on their machine and make it work. I can't. I know it's close, but beating my head is beginning to hurt too much now.

I've offered money. I will go somewhere else and try this all over again if that can't happen here.

I have been trying to work between two different forums at this site, and that's too confusing.

Thanks for all you've done so far. If you (or anyone else) know of some better solution for me in this project, I'll consider it. It won't be ASP. I don't have it installed and, from what I've seen on investigating it, I'd have just as much trouble with it as the Perl.

Brian
 
Jon,

I can't let this alone and don't know where else to go frankly.

After finding a suggestion about placing a print statement:

print "Content-type: text/html\n\n";
print "No boo boo!";
exit;

at the top of the script (just under the shebang line), running the script, and moving it down one line at a time until the error appears, I find that this section...

# Read XML file to array of strings
$xml_file="c:\program files\merak\whitelist_test.xml";
open(XML, $xml_file) || die("Could not open file!");
@xml=<XML>;
close(XML);

...and specifically the "open(XML, $xml_file) || die("Could not open file!"); causes the error. The error messages in the Apache error log are:

Premature end of script headers: c:/program files/apache group/apache/cgi-bin/test.cgi

and

Could not open file! at c:\PROGRA~1\APACHE~1\apache\cgi-bin\test.cgi line 17.

I can open the file just fine with an editor - and it will open in a browser fine also.

Does that give you something to go on?

Thanks,

Brian
 
You definitely have another cgi script that runs and you are using localhost?

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top