Just started out with PHP.Made a nice little page in DW04,using form to send data to my database created in MYSQL.
So here is my code:
form:
and my insert.phpCode:<form name="form1" method="post" action="insert.php"> ime: <input type="text" name="Ime" /> prezime: <input type="text" name="Prezime" /> email: <input type="text" name="email" /> komentar: <textarea name="komentar"></textarea> <input type="submit" name="POSALJI" value="POSALJI"> </form>
The thing is,nothing happens!No data is inserted,no error.Echo displays nothing.Guess I'm missing something here,so if anyone can help...thank you!Code:<?php $con = mysql_connect("localhost","myname","mypass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("korisnik", $con); $sql="INSERT INTO podaci (ime, prezime,email,komentar) VALUES ('$_POST[ime]','$_POST[prezime]','$_POST[email]','$_POST[komentar])"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo $sql; mysql_close($con) ?>




Reply With Quote