Browse Source

Stores comments from interest inventory as 1.

devel
Jonathan Rosenbaum 9 years ago
parent
commit
5a36eea47b
  1. 17
      contact_add_edit.php
  2. 7
      sql/populate.sql

17
contact_add_edit.php

@ -174,7 +174,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
if ( is_null($selections[$interest_id]) ) { //INSERT
if( !is_null($interest_checked[$selection]) ) {
$sql = "INSERT INTO selections (contact_id, selection, selection_value)
VALUES (" . $_POST['contact_id'] . ",'" . $interest_id . "',1);";
VALUES (" . $_POST['contact_id'] . "," . $interest_id . ",1);";
$result = mysql_query($sql, $YBDB) or die(mysql_error());
}
} else { //DELETE
@ -186,6 +186,11 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
}
}
if ($_POST['comments']) {
$sql = "INSERT INTO selections (contact_id, selection, selection_value)
VALUES (" . $_POST['contact_id'] . ", 1,'" . $_POST['comments'] . "');";
$result = mysql_query($sql, $YBDB) or die(mysql_error());
}
if ($_POST['contact_id_entry'] == 'new_contact'){
@ -337,11 +342,17 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
$rows = $rows + $columns;
}
?>
<?php if($volunteer_interest_comments) { ?>
<?php if($volunteer_interest_comments) {
$sql = "SELECT selection_value AS comments FROM selections
WHERE selection=1 AND contact_id=" . $row_Recordset1['contact_id'] . ";";
$query = mysql_query($sql, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($query);
?>
<tr><td>&nbsp;</td></tr>
<tr>
<td class="center_comment" colspan="2"><label id="contact_comment">Comments</label>
<textarea name="comment" cols="45" rows="3"></textarea></td>
<textarea name="comments" cols="45" rows="3"><?php echo $result['comments']; ?></textarea></td>
</tr>
<?php } ?>
</table>

7
sql/populate.sql

@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS options (
option_name_id int(10) unsigned NOT NULL AUTO_INCREMENT,
option_name varchar(64) NOT NULL UNIQUE,
PRIMARY KEY (option_name_id)
) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-- selections
-- stores the volunteer interest selections made by people
@ -213,4 +213,7 @@ CREATE TABLE IF NOT EXISTS selections (
selection_value text,
FOREIGN KEY (contact_id) REFERENCES contacts (contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (selection) REFERENCES options (option_name_id) ON DELETE CASCADE ON UPDATE CASCADE
) DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- create the comment row first
INSERT INTO options (option_name) VALUES("comments");

Loading…
Cancel
Save