Both sides previous revisionPrevious revisionNext revision | Previous revision |
dg:greenbox:add [14 Sep 2011 20:57] – james | dg:greenbox:add [14 Sep 2011 22:43] (current) – james |
---|
====== Add Item to Green Box ====== | ====== Add Item to Green Box ====== |
<php> | <php> |
| error_reporting(E_ALL); |
| ini_set('display_errors', true); |
| |
include("/var/www/html/greenbox/sqlconnect.php"); | include("/var/www/html/greenbox/sqlconnect.php"); |
include("/var/www/html/greenbox/sqlconnect2.php"); | include("/var/www/html/greenbox/sqlconnect2.php"); |
| |
$query = "INSERT INTO Items (Year,Type,Freq,Class,Description,Comments,SAN,Contributor,Email,MoreInfoURL,Cell) | $query = "INSERT INTO Items (Year,Type,Freq,Class,Description,Comments,SAN,Contributor,Email,MoreInfoURL,Cell) |
VALUES | VALUES ('$_POST[Year]','$_POST[Type]','$_POST[Freq]','$_POST[Class]','$_POST[Description]','$_POST[Comments]','$_POST[SAN]','$_POST[Contributor]','$_POST[Email]','$_POST[MoreInfoURL]','$_POST[Cell]')"; |
('$_POST[Year]','$Type','$Freq','$Class','$Description','$Comments','$SAN','$Contributor','$Email','$MoreInfoURL','$Cell')"; | |
$result = mysql_query($query) | $result = mysql_query($query) |
or die ("Couldn't execute query."); | or die ("Couldn't execute query."); |
$ItemID = mysql_insert_id(); // 46 | |
| $Year=$_POST['Year']; |
| echo $Year; |
| </php> |
| |
echo $result; | |
| |
echo "The following item has been added to the database:<br> | |
<ul> | |
<li>Type: $Type | |
<li>Frequency: $Freq | |
<li>Class: $Class | |
<li><b>$Description </b>- $Comments | |
<li>SAN penalty: $SAN | |
<li>Contributed by: $Contributor $Email | |
<li>More info from: $MoreInfoURL | |
<li>Cell $Cell available from $_POST[Year] | |
\n"; | |
| |
echo "</ul>"; | |
echo "Add Another Item\n"; | |
| |
</php> | |
<html> | <html> |
| <br> |
<b>Add as much detail as you can in the form below, fields which cannot be blank are indicated with an Asterisk <font color=red>*</font></b> | <b>Add as much detail as you can in the form below, fields which cannot be blank are indicated with an Asterisk <font color=red>*</font></b> |
<form action="/doku.php/dg/greenbox/add" method="post"> | <form action="/doku.php/dg/greenbox/confirm" method="post"> |
<table> | <table> |
<tr> | <tr> |