function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to do the following but I don't have any success. Could you help
me here...
I have this code in mu page:

<?php
include "script/functions.php";
require 'script/common.inc';
$valid = TRUE;

if (isset ($_POST['submit'])) {
    foreach($_POST as $key=>$value) {
      $$key = $value;
    }

    $valid = $fn = checkLength($fname, 2, 50);
    $ln = checkLength($family, 2, 50);
    $valid = $valid && $ln;
 $cm = checkLength($company,0,50);
 $valid = $valid && $cm;
 $ml = checkLength($MOL,0,50);
 $valid = $valid && $ml;
 $dnum = checkLength($dannum,0,12);
 $valid = $valid && $dnum;
 $bst = checkLength($bulstat,0,12);
 $valid = $valid && $bst;
 $phn = checkLength($phone,3,20);
 $valid = $valid && $phn;
    $em = checkEmail($email);
    $valid = $valid && $em;
 $usr = checkLength($username,4,10);
 $valid = $valid && $usr;
    $ps = checkLength($password,4,16);
    $valid = $valid && $ps;
 $ps2 = checkLength($password2,4,16);
    $valid = $valid && $ps2;
    $ps2 = $password == $password2;
    $valid = $valid && $ps2;
 $adr = checkLength($Addr,3,70);
 $valid = $valid && $adr;
 $cty = checkLength($City,2,50);
 $valid = $valid && $cty;
    $zp = checkLength($zipcode,2,10);
    $valid = $valid && $zp;
    if ($valid) { //-----------------------------------------CHECK
THIS-------------------------------

              doReg($fname,$family,$company, $MOL, $dannum, $bulstat,
$phone, $email, $username, $password, $payment, $maillist, $Addr, $City,
$zipcode,

$Country, $shippingName, $shippingFamily, $shippingphone, $shippingAddr,
$shippingcity, $shippingzipcode, $shippingCountry);
  exit;

           }
} else {
    $fn = $ln = $cm = $ml = $dnum = $bst = $phn = $em = $usr = $ps = $ps2 =
$adr = $cty = $zp = TRUE;
    $fname = $family = $company = $MOL = $dannum = $bulstat = $phone =
$email = $username = $password = $password2 = $Addr = $City = $zipcode = '';
}

?>

This is a page with validation. If everything is correct($valid==TRUE), I
would like to call doReg which must do the following:

function doReg($fname1="",$family1="",$company1="", $MOL1="", $dannum1="",
$bulstat1="", $phone1="", $email1="", $username1="", $password1="",
$payment1="", $maillist1="", $Addr1="", $City1="", $zipcode1="",
$Country1="", $shippingName1="", $shippingFamily1="", $shippingphone1="",
$shippingAddr1="", $shippingcity1="", $shippingzipcode1="",
$shippingCountry1="")
{

  mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD);


  mysql_db_query($DB, "insert into users(name,family,company, MOL, taxnum,
bulstat, phone, email, username, password, payment, maillist, Addr, City,
zipcode, Country, shippingName, shippingFamily, shippingphone, shippingAddr,
shippingcity, shippingzipcode, shippingCountry)
values('$fname1','$family1','$company1', '$MOL1', '$dannum1', '$bulstat1',
'$phone1', '$email1', '$username1', '$password1', '$payment1', '$maillist1',
'$Addr1', '$City1', '$zipcode1',
'$Country1','$shippingName1','$shippingFamily1',
'$shippingphone1','$shippingAddr1', '$shippingcity1', '$shippingzipcode1',
'$shippingCountry1')");

}

The problem is that it doesn't work. I have tryed to put the code from the
doReg function in the page and it works. But when I call the function I
can't insert nothing. Why is that? could you tell me?


Thank you in advance!!

Viktor

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux