Problem involving checkbox and Postgresql

From: Jeff Self <jself(at)nngov(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Problem involving checkbox and Postgresql
Date: 2002-06-20 16:36:40
Message-ID: 1024591004.13953.13.camel@jselfpc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

I've got a table with a field called driving_required with a boolean
type and default 'true'. I've built a web page which contains the
following lines for displaying a checkbox:

<tr><td width="25%" class="form">Driver's License Required?</td>
<td width="75%" class="form"><input type="checkbox"
name="driving_required" CHECKED></td></tr>

After the form is submitted, it calls a php file called
jobpostresults.php which enters the data from the form into the database
and displays the results on the page.

Here's the section that enters the form data into the database:

// Add Job Description Details
$jddquery = "INSERT INTO job_description_details (description_id,
effective_date, driving_required, submitted_on, submitted_by,
sm_description, responsibilities, behaviors, skills, experience,
requirements) VALUES
('$description_id','$effective_date','$driving_required',now(),'$submitted_by','$sm_description','$responsibilities','$behaviors','$skills','$experience','$requirements')";

$jddresult = pg_exec($conn, $jddquery);
if (!$jddresult)
exit;

When I input the data and click on submit I get the following error
message:

Warning: pg_exec() query failed: ERROR: Bad boolean external
representation 'on'
in /var/www/nngov/admin/jobpostresults.php on line 46

It looks like the html form is producing 'on' for the value of
driving_required. How do I get this changed to 'true' in PostgreSQL?

--
Jeff Self
Information Technology Analyst
Department of Personnel
City of Newport News
2400 Washington Avenue
Newport News, VA 23607
757-926-6930

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Surojit Niyogi 2002-06-20 17:39:43 Re: Problem involving checkbox and Postgresql
Previous Message Jules Alberts 2002-06-20 08:45:25 Re: good PHP book for postgresql frontend