I have a form that deletes and adds to a reservation calendar. The add works fine. After each addition an updated list of appointments is displayed. However, on deletion the page goes blank. And you have to close and reopen to get the results. Fortunately delete is working, just no refresh:
$cur = CGI->new();
$mode = "default";
if($cur->param("mode")) {
$mode = $cur->param("mode");
}
$content .= print_form();
if (($cur->param("delete")) { $content .= delete_appointment(); }
if($cur->param("laptop")){ $content .= update_day(); }
$content .= display_appointments();
open (TEMPLATE, "../template.shtml")||dienice("Content-type: text/html
+\n\nCould not find template");
while (<TEMPLATE>){
$page .= $_;
}
$page =~ s/<!-- ?content ?-->/$content/ig;
close (TEMPLATE);
print "Content-type: text/html\n\n$page";
You would think it would display the contents after a deletion since it displays after an addition. print_form() returns the form to be filled out, delete_appointments handles removal from the db and does not return anyting, updatE_day adds to database and returns error if any, and display returns the list of reservations.
I think my error is that the script stops executing after a delete since it thinks its done and doesn't run back through. How would I go about refreshing it then so the appointments/reservations display with each deletion?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.