Hello PLUGgers,

I need your help.

I have my SURVEY FORM in http://pascual.homelinux.org which is written
mostly in HTML and a little on PHP 4.2.1-8mdk.  I'm running Apache
1.3.26-5mdk as my web server.  My PHP and Apache are installed in my
gateway box which has an internal IP address of 192.168.0.1.  I have
PostgreSQL 7.2.1-8mdk installed in my 192.168.0.2 box.

My problem is, I don't know why I can't "SUBMIT" from my SURVEY FORM to
my PostgreSQL server.  I already checked my connection by accessing
PostgreSQL remotely from my 192.168.0.1 box and I was able to connect.

Did I miss something?

Below is the snippet of my submit.php

- - - < s n i p > - - -

<html><head><title>Processing Form...</title></head>
<style>
        {text-decoration:none; color:#00ccff}
</style>
<body>
<?php

// Connect to the database
require_once('DB.php');
$db = DB::pg_connect("pgsql:[EMAIL PROTECTED]/survey");
if (DB::iserror($db)) {
        die($db->getMessage());
}

// Die on GET requests (For security)
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
        die ("Works with HTTP-POST Method only.");
}

// Get the form values
$lastname = $_POST['lastname'];
$firstname = $_POST['firstname'];
$mi = $_POST['mi'];
$age = $_POST['age'];
$gender = $_POST['gender'];
$status = $_POST['status'];
$industry = $_POST['industry'];
$position = $_POST['position'];
$occupation = $_POST['occupation'];
$tctco = $_POST['tctco'];
$cstco = $_POST['cstct'];
$tceoa = $_POST['tceoa'];
$cseoa = $_POST['cseoa'];
$tcds = $_POST['tcds'];
$csds = $_POST['csds'];

// Issue the SQL query to insert the values
$sql = "INSERT INTO results values (";
$sql .= "'$lastname','$firstname','$mi','$age','$gender',";
$sql .= "'$status','$industry','$position','$occupation',";
$sql .= "'$tctco','$cstco','$tceoa','$cseoa','$tcds','$csds')";
$q = $db->query($sql);

?>

// Display a confirmation page

<h1>Processing Form</h1>
The form data you submitted has been added to our database. Thank you
very much.
<br><a href="index.php">Return to index</a>
</body>
</html>

- - - < s n i p > - - -

Below are the queries from my PostgreSQL:

survey=# \z
        Access privileges for database "survey"
  Table  |              Access privileges               
---------+----------------------------------------------
 results | {=,postgres=arwdRxt,bintut=a,apache=arwdRxt}
(1 row)

survey=# \d results
        Table "results"
   Column   | Type | Modifiers 
------------+------+-----------
 lastname   | text | 
 firstname  | text | 
 mi         | text | 
 age        | text | not null
 gender     | text | not null
 status     | text | not null
 industry   | text | not null
 position   | text | not null
 occupation | text | not null
 tctco      | text | not null
 cstco      | text | not null
 tceoa      | text | not null
 cseoa      | text | not null
 tcds       | text | not null
 csds       | text | not null

- - - < s n i p > - - -


Thank you very much...

Marvin Pascual


_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to