Do you have register_globals on?
If not ayou have to get the POST information manually.
ie..  $job = $_POST['job']

Also are you sure that you are connecting to the database successfully?

add:
or die('could not connect')

to the end of your mssql_pconnect and mssql_select_db statements.

So your save.php should something like this.

<a href=view.php">Search data</a>
</body>
</html>
<?
$name = $_POST['name'];
$job = $_POST['job'];
$subject = $_POST['subject'];

$date=date('Y-m-d H:i:s');
$link = mssql_pconnect("sql","sa","1234") or die("Could not connect to db
server");
mssql_select_db("phpbook",$link) or die("Could not connect to server");
$str = " INSERT INTO staff (name,job,subject)
VALUES('$name','$job','$date','$subject',)";
mssql_query($str,$link);
?>

Chris

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Dear All,
>
> There is a sample that can't to insert any data ( via variable ) in
> MS-SQL :
>
> insert.php:
> <form action="save.php" method="post">
> <table border="0" align=center>
> <input type="text" size="20" name="name" maxlength="8" value="<? echo
> $GBName ?>"><br>
> Job<input type=text" size="16" name="job"><br>
> Subject<input type="text" size="30" name="subject"><br>
> <input type="submit" value="SubMit">
> </center>
> </table>
> </form>
>
> save.php:
> <a href=view.php">Search data</a>
> </body>
> </html>
> <?
> $date=date('Y-m-d H:i:s');
> $link = mssql_pconnect("sql","sa","1234");
> mssql_select_db("phpbook",$link);
> $str = " INSERT INTO staff (name,job,subject)
> VALUES('$name','$job','$date','$subject',)";
> mssql_query($str,$link);
> ?>
>
> After insert data by using save.php, I found no any data from the
> Database system ( MS-SQL ), but I sure the Database System is no problem
> !
>
> So, how can I fix this kind of problem ( Sorry, I'm not familar with php
> ) ?
> Many thank for your help !
>
> Edward.

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

Reply via email to