Listing 1807
Followup to listing-1806.php, submitted by anonymous user.
Submitted by sam, 29 November 2008
$company = $_POST["company"]; $title = $_POST["title"]; $pitch = $_POST["pitch"]; $date = $_POST["month"]+$_POST["day"]+$_POST["year"]; $contact = $_POST["contact"]; $address = $_POST["address"]; <html> <head> <title>Create new cover letter</title> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript" src="datepicker.js"></script> </head> <body> // Connecting, selecting database $dbconn = pg_connect("host=localhost dbname=jobs user=user password=pass") or die('Could not connect: ' . pg_last_error()); $newrow = array( 'ID' => '8', 'company' => $company, 'title' => $title, 'pitch' => $pitch, 'date' => '2008-01-01', 'contact' => $contact, 'address' => $address ); $submitform = pg_insert($dbconn, 'coverletter', $newrow); if ($submitform) { echo "POST data is successfully logged\n"; } else { echo "User must have sent wrong inputs\n"; } <form method="post" action=" echo $PHP_SELF;"> Date:<br /><select id="day"></select> <select id="month"></select> <select id="year"></select><br /> Company:<br /><input type="text" size="25" maxlength="50" name="company"><br /> Title:<br /><input type="text" size="25" maxlength="50" name="title"><br /> Contact person:<br /><input type="text" size="25" maxlength="50" name="contact"><br /> Address:<br /><textarea rows="3" cols="40" name="address" wrap="physical">Default address here</textarea><br /> Pitch:<br /><textarea rows="10" cols="50" name="pitch" wrap="physical">Default pitch here</textarea><br /><br /> <input type="submit" value="Save" name="submit"> </form> <script type="text/javascript"> //populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select) window.onload=function(){ populatedropdown("day", "month", "year") } </script> </body> </html>
