<?php
session_register( "pcdata" );

//Figure out what they want to do
if( !$command ) main();
if( $command == "postcodeLookup" ) postcodeLookup();
exit;

function main()
{
    global $pcdata, $othervar1, $othervar2;

    echo( "<form name=postCode
action=\"$PHP_SELF?command=postcodeLookup\">\n" );
    echo( "<input type=text name=firstName
value=\"$pcdata[firstName]\">\n" );
    echo( "<input type=text name=lastName
value=\"$pcdata[lastName]\"><br><br>\n" );
    echo( "<input type=text name=phone value=\"$pcdata[phone]\"><br>\n" );
    echo( "<input type=text name=emailAddress
value=\"$pcdata[emailAddress]\"><br>\n" );
    echo( "<input type=submit value=\"Submit\">\n" );
}

function postcodeLookup()
{
    global $pcdata, $youknowit, $maybe;

    $result = $database->query( "INSERT INTO victims( idNumber, firstName,
lastName, phone, emailAddress, whateverElse ) VALUES( '',
\"$pcdata[firstName]\", \"$pcdata[lastName]\", \"$pcdata[phone]\",
\"$pcdata[emailAddress]\", \"$pcdata[whateverElse]\" )" );
    if( !$result ) echo( "Whoa.. Something's not working right here.." );

    //put code here to go do the postcode lookup

    showResults();
}

?>

Just an idea.. Hope it will help or jog something..

Bob Weaver

> I am making use of AFD postcode lookup application.
> What it dose is ask for your postcode and returns your address.
> You may have seen this around the web..
> Well my problem is that I have added 3 extra fields
> Name, email, phone number
> And I need to save this info.
> I have tried sessions and cookies but have just noticed
>
> That the form action is a cgi file on the afd server. Thus this is
> stopping me Saving info.
> Any ideas on how I can save the info.
> I am in a back to the wall situation so any pointer and guidance is
>
> Most appreciated.

> P.S Had it work all fine and dandy when I added the extra info after
> postcode lookup but customer insisted he wants it this way round.
> Customers...
> (cant live with them, cant live without them...)
> Dave Carrera
>
> Php Developer
>
> http://davecarrera.freelancers.net
>
> http://www.davecarrera.com



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to