Solved

FORM/file-update/new HTML

Posted on 1998-11-29
3
171 Views
Last Modified: 2013-12-25
I need to update links on a web page.
I made a CGI using perl to read a test file (with descriptions and URLs) and "plant" the HTMLed links to an already-existing web-page.

now- I made a form which receives a description and a URL - the goal is to append the new data to the text file (which holds all my links) and then activate the converting  utility (which plants the data in the web-page).

my form on the web page looks like this:
---start---
<form action="http://vortex.technion.ac.il/shlomo/cgi-bin/addlink.cgi"
method=POST>
<B><U>Add a new Link:</U></B><BR>
Description: <input type=text name="description">
URL: <input type=text name="URL">
<input type=submit value="Submit this data">
</form>
----end----

and the CGI listing is:
---start---
#!/usr/bin/perl
# nameage.cgi
require 'cgi-lib.pl'

&ReadParse(*input);
$des=$input{'description'};
$url=$input{'URL'};

   print "Content-Type: text/html\r\n\r\n";
   print "<HTML><HEAD><TITLE>Error</TITLE></HEAD>\n";
   print "<BODY BACKGROUND=\"http://vortex.technion.ac.il/~shlomo/bg_marble_gre$
   print "<body>\n";
   print "URL: <B><I>$url</I></B> linked!\n";
   print "\n";
   print "<BR> <BR>\n";
   print "<CENTER><A HREF=\"http://vortex.technion.ac.il/~shlomo/home.html\">BA$
   print "<BR><BR>\n";
   print "</body> </html>\n";
open( TEXTfile,">> ~/public_html/home")||die "$!\n";
print TEXTfile "$des\n";
print TEXTfile "$url\n";
close(TEXTfile);
exec '~/makeHTMl.pl ~/public_html/home';
----end----

now:
(*)home (which resides at ~/public_html)
   is the test file with the links
(*)addlink.cgi - is the cgi

----------->
for some strange reason I get the "result" HTML on screen after submitting the data- - but I get no change in the 'home' data file and therefore no change in the web-page after executing the links->html perl utility.

What am I missing here?
0
Comment
Question by:shlomoy
3 Comments
 
LVL 3

Accepted Solution

by:
arnond earned 100 total points
ID: 1829820
Hi,
use the 'system' function instead of the 'exec'.

Bye..... :-)
Arnon David (make sure it's an A)
0
 
LVL 84

Expert Comment

by:ozo
ID: 1829821
Try expanding the '~'s, and checking whether die "$!" said anything
0
 
LVL 8

Author Comment

by:shlomoy
ID: 1829822
Want points, arnond? BEG!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now