Jump to content

passing value to a query string in php


sailu_mvn

Recommended Posts

I want to pass a value of 66 to query string

 

register.php

--------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

  <title>CC</title>
</head>
<body>
 <br><form style="height: 319px;" method="post" action=[size=15pt]"action.php?pi=66"[/size] name="form1">

  <p>Fist Name         

      

  <input name="m_fname" maxlength="25" id="fname" type="text">

  <br>

  <br>

    Last Name          

  <input name="m_lname" maxlength="25" id="lname" type="text">

  <br>

    

    <br>

    Company Name  

    <input name="m_company" maxlength="25" id="company" type="text">

    <br>

    

    <br>

    Address 

    <input name="m_add1" id="add1" type="text">

    <br>

    

    <br>

    City           

           

  <input name="m_city" maxlength="25" id="city" type="text">

  <br>

    

    <br>

    Email            

        

  <input name="m_email" maxlength="25" id="email" type="text"> 

  <br>

    Telephone            

        

  <input name="m_tel" maxlength="25" id="email" type="text">

  </p>

  <p>

    <label>Gender </label>

    <label>

    <input type="radio" name="m_gender" value="M">

Male </label>

    <input type="radio" name="m_gender" value="F">

Female </p>

  <p>Tenant 

    <label>

    <input type="radio" name="is_tenant" value="Y">

    Yes	</label>

    <input type="radio" name="is_tenant" value="N">

    No</p>

  <p> 

    <label> 

    <input name="Submit" type="submit" value="Submit">

    </label>

</p>

  <p><br>

    </p>

</form>

 

 

--------------------------------------------------------------------------------------------

action.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>CC</title>

</head>



<body>

<?php
        $db = pg_connect('host=localhost dbname=ism user=postgres');

        $firstname = pg_escape_string($_POST['m_fname']);

        $surname = pg_escape_string($_POST['m_lname']);

	$company = pg_escape_string($_POST['m_company']);

	$add =  pg_escape_string($_POST['m_add1']);

	$city = pg_escape_string($_POST['m_city']);

	$emailaddress = pg_escape_string($_POST['m_email']);

	$telephone=pg_escape_string($_POST['m_tel']);

	$gender = pg_escape_string($_POST['m_gender']);

	$tenant = pg_escape_string($_POST['is_tenant']);

	[size=15pt]$pi = $_REQUEST['pi'];[/size]


        $query = "INSERT INTO members(m_fname, m_lname,m_company,m_add1,m_city,m_email,m_tel,m_gender,is_tenant) VALUES('" . $firstname . "', '" . $surname . "', '" . $company. "','" . $add . "','" . $city . "','" . $emailaddress . "','" . $telephone . "','" . $gender . "','" . $tenant . "')";

        $result = pg_query($query);

	printf ("These values were inserted into the database - %s %s %s %s %s %s", $firstname, $surname, $company, $add, $city, $emailaddress, $telephone,$gender,$tenant);

?>



</body>

</html>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.