I have a page which pulls a listing of out of office employees. Next to each name there is a delete button which allows users to delete themselves from the out of office list. My problem is concerned with how to delete the correct individual:
$future[$n] = "<tr><td><form method=post> <input type=hidden name=confname value=\'$firstName\'> <input type=hidden name=starttime value=\'$lastName\'> <input type=hidden name=endtime value=\'$start_date\'> <input type=hidden name=reservee value=\'$end_date\'> <input type=submit value=delete></td><td><center>$firstName $lastName</center><td><center>$email</center><td><center>$voicemail</c +enter><td><center>$start_date2</center><td><center>$end_date2</center +></form></tr>"; print qq~<h3 align=center>Future Out of Office List </h3>~; print qq~<br><br>~; print qq~The following will be out of the office until the date specified:~; print qq~<br><br><br>~; print qq~<TABLE border="2" align="center"><tr><th><th>Employee<th>Checking E-mail<th>Checking Voicemail<th>Leaving<th>Returning~; for($i = 0; $i < @future; $i++) { print qq~$future[$i]~; } print qq~</TABLE>~; }


I then check to see if delete is pressed:
if($session_cgi->param("delete")) { $firstName = $session_cgi->param("firstName"); $lastName = $session_cgi->param("lastName"); $startdate = $session_cgi->param("start_date"); $enddate = $session_cgi->param("end_date"); $db = dbLoad($db); $select_statement = "SELECT id FROM Employees WHERE lastName = '$lastName' and firstName = '$firstName'"; $select_it = $db->prepare($select_statement); $rc = $select_it->execute() or die "Could not run query '$select_statement'\n"; $select_it->bind_columns(undef, \$user_id); $select_it->fetchrow_arrayref(); $statement = "DELETE FROM Out_Of_Office WHERE id = '$user_id' and start_date = '$start_date' and end_date = '$end_date'"; $statement = $db->prepare($statement); $rv = $statement->execute() or die "Couldn't execute query '$query' \n"; $db->disconnect();

However, nothing is ever deleted and the information still all the information appears on the screen. I've ensured that the date formats are the same as well as user ids, lastnames, firstnames, etc. I know I could do a join and maybe only use a delete statement, but that's for future improvements.

In reply to Form not parsing correctly by intranetman

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.