Here's the code--I edited out information that isn't relevant so don't expect it to work:
BEGIN { use CGI ':all'; use XML::Simple; use XML::LibXML; use Data::Dumper; use File::Copy; use Tie::IxHash; my $htmlfile = "whiteboard.html"; my $xmlfile = "whiteboard.xml"; tie %$xml, "Tie::IxHash", %{XMLin($xmlfile, SuppressEmpty => undef +, )}; #no forcearray needed here because we know the elements don't doub +le. if ( (!(param("Apply Edit"))) && (!(param("Cancel"))) ) #so if the page is a first load, or a change in selection, or the +"Clear" button was pressed { print header(); print start_html( -title => "Edit Whiteboard", -bgcolor => 'pu +rple' ) ; print font( { -color => 'yellow' } ), h1("Whiteboard Editor"); print h5("Type <br&gt to create a new line in the webpage displ +ay."); print start_form(); @keys = keys( %{ $xml->{name} } ); print popup_menu( -name => 'selname', -values => \@keys, -align => 'top', -onChange => "submit();" ); if ( param('selname') ) { if ( param("Clear") ) { param( 'thenote', "" ); } else { param( 'thenote', "" ); #we need this to clear the not +e if it's already blank, otherwise the #text from the defined note will persist param( 'thenote', $xml->{name}->{ param('selname') }-> +{note} ); } print textarea( -name => 'thenote', -rows => 10, -columns +=> 55 ); } else { param( 'thenote', $xml->{name}->{ $keys[0] }->{note} ); print textarea( -name => 'thenote', -rows => 10, -columns +=> 55 ); } print br(), br(), submit("Apply Edit"), "\t ", submit("Cancel" +), "\t ", submit("Clear"); print end_form(); my $mtime = localtime( ( stat "edit.pl" )[9] ); print hr(), font( { -size => '-1' }, "Modified $mtime", br(), "Created and maintained by Terry Tate, Office Lineba +cker" ); print end_html(); } #end if !param else { #this is a repost
if ( param("Apply Edit") ) { #print header(); #if the "Apply Edit" button was pushed my $note; if (!(param("thenote"))) {$note=" ";} else{ $note = param("thenot +e"); } $xml->{name}->{ param('selname') }->{note} = $note || die +"assignment operator failed."; print XMLout( $xml, OutputFile => $xmlfile, NoAttr => 1, S +uppressEmpty => undef ) || die "XMLout busted: $! ."; my $title = "Whiteboard" || die "Can't assign title"; open( OUTFILE, ">", $htmlfile ) || die "Can't open $htmlfi +le for writing."; select(OUTFILE) || die "can't select OUTFILE"; print start_html( -title => $title, -style => { 'src' => 'basic.css' } )|| die "Can't print start_html"; print "<div id='masthead'>"; print h3( a( { href => "../" }, "MFST" ) ); print h1( "Whiteboard", span($title) ); print "</div>"; print "<div id='main'><div id='content'>"; print "<table cols=2 rows='10' width='100%' border='1'>"; print "<th bgcolor='#00FF99' align='center'><h3 align='center'>Name</h3></th +> <th bgcolor='#00FF99' align='center'><h3 align='center'>Location/Notes +</h3></th>"; my $counter = 0; foreach $i (keys( %{ $xml->{name} } )) { if (!($xml->{name}->{$i}->{note})){ $xml->{name}->{$i}->{note}=" "; } if ( $counter == 0 ) { print "\n<tr>\n<td width='30%'><h1 align='center'>$i</h1></td>\n<td width='3 +0%'><h1 align='center'>$xml->{name}->{$i}->{note}</h1></td> </tr>"; } else { print "\n<tr>\n<td width='30%'><h2 align='center'>$i</h2></td>\n<td width='3 +0%'><h2 align='center'>$xml->{name}->{$i}->{note}</h2></td> </tr>"; } ++$counter; } print "</table>"; print "<a href='edit.pl'><h2 align='center'>Edit Whiteboard</h2></a> </div> <div id='footer'> <a href='#masthead' id='totop'>Return to Top of Page</a>"; my $mtime1 = localtime( ( stat $xmlfile )[9] ); print hr(), font( { -size => '-1' }, "Underlying data last edited $m +time1" ), br(); print "<p> This page is restricted to MFST staff. </p> </p> </div> </div> </body>"; print end_html(); close(OUTFILE); select STDOUT; #rename( $htmlfile2, $htmlfile ) || die "Can't rename HTML + file"; print redirect( 'whiteboard.html'); } #end else elsif (param("Cancel")) { print redirect( 'whiteboard.html'); } else { #should be nothing else it could be, but just in case print header(), start_html(), "YOU HAVE REACHED THIS PAGE IN ER +ROR",end_html(); } } #end else } #end begin
The thing with keeping track with a counter in the table creation is because there is also a "General Note" that should come first and get different formatting than entries from individual people.

_________________________________________________________________________________

I like computer programming because it's like Legos for the mind.


In reply to Re: An Office In/Out Whiteboard Web Page by OfficeLinebacker
in thread An Office In/Out Whiteboard Web Page by OfficeLinebacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.