Jump to content


Photo

Need help with form php/mysql


  • Please log in to reply
1 reply to this topic

#1 reag27

reag27
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 28 September 2005 - 11:10 AM

Hello
I need help with a form I created, I'm having trouble storing information from the form in a mysql database, the field that seems to be updating is the auto_increment the rest of the fields you just gives me blank, I just started using php/mysql 5 days ago, I have tried several options none seem to work

I'll apreciate all the help I can get, here is the form and script

<html>
<body>
<form action="page2.php" name="forward" method="post">
Name:<input type="text" name="name" value=<? echo $name; ?>">
Address:<input type="text" name="address" value=<? echo $name; ?>">
Career:<input type="text" name="career" value <? echo $career; ?>">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>


<html>
<body>
<?php

$link=mysql_connect("localhost","root");
mysql_select_db("text");

$sql="insert into table1";
$sql .="(num,name,address,career)";
$sql .="values('','$name', '$address', '$career')";

mysql_query($sql);
?>
</body>
</html>

#2 Mattyspatty

Mattyspatty
  • Members
  • PipPipPip
  • Advanced Member
  • 76 posts
  • LocationEngland :D

Posted 28 September 2005 - 11:41 AM

try not using num and '' it may work, else the autonumber isnt a primary key which can cause a problem
ok, so my PHP is a bit rusty... my replies are 90% ok.
the other 10% either have syntax errors or are the "hard solution"
http://www.php.net  http://www.google.com - Are your friends!

I have a C++ problem with 'keybd_event' in certain applications. if you can help me PM me! :P
Needs motivation to create another quick cash website. I need a new TV




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users