Payne wrote:

> Hi,
>
> I am working a form to pass information from it to mysql data.  I am
> able to connect to the database. But nothing is being pass from the form
> to the php page.  This is my php code...
>
> ---------------------form.html----------------------------------------------------
>
> <html>
> <head>
>     <title>Untitled</title>
> </style>
> </head>
> <body>
> <form name="form1" method="post" action="addlead.php">
> <input name="title" type="text" size="40">
> <input name="f_name" type="text" size="40">
> <input name="l_name" type="text" size="40">
> <input type="submit" name="Submit" value="Submit Information">
> </form>
> </body>
> </html>
>
> --------------------------addleads.php------------------------------------------

first off i guess this is addlead.php (without the s or your post action is wrong
above.)

>
> <?
>
> include("./config.php");
>
> $sql = "INSERT INTO $table_name
>         (leads_id, title, f_name, l_name)
>         VALUES
>         ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")";

Don't insert data into your auto-increment field.  Just use $sql = "INSERT INTO
$table_name (title, f_name, l_name)
        VALUES ('$title', '$f_name', '$l_name')"; and use ' instead of " to encapsulate
your variables.  If they are not available in PHP after posting use $_POST["varname"]
instead of $varname.  (even in the SQL query if you prefer)

Justin

>
>
> //debug tool
>
> print $sql;
>
> $result = mysql_query($sql, $connection) or
>     die ("Couldn't execute query.");
>
> ?>
> <html>
> <head>
>     <title>Untitled</title>
>
> </style>
> </head>
>
> <body>
> <? echo $title ?>
> <br>
> <? echo $f_name ?>
> <br>
>  <? echo $l_name>
>
> -----------------------------------------------------------------------------------
>
> What I am getting this....
>
> INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', "", "", "")
>
> *Salutation*
>
>
>
> *First Name*
>
>
>
> *Last Name*
>
> As you can see nothing is being pass...is there some other command
> beside the print $sql statement to see why nothing is being passed.
>
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to