Hi Guys,
I really am a novice and found a script on webmonkey. Basically all I want
to do is to add records to my database. In my database I have a table called
research_main with the fields already created.
I have tried to bodge a script to work for me. it doesn't. It looks as
though it works but I get no data posted. What have I done wrong?
If you want me to put a statement in anywhere to check something please let
me know where you want me to put it as I really am useless with this.
can you tell me what is wrong with this script.
:-( I am trying honest
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect(" localhost", "uname", "password") ;
mysql_select_db ("dbtouse",$db) ;
$sql = "INSERT INTO research_main
(date_inv,info, medium_name,pla ce_name,date_de ath,verified_ev ent,closed_even t
) VALUES
('$date_inv','$ info','$medium_ name','$place_n ame','$date_dea th','$verified_ e
vent','$closed_ event')";
$result = mysql_query($sq l);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<p>Date Of Event:
<input name="date_inv" type="Text" id="date_inv">
<br>
Information to be researched:
<textarea name="info" cols="75" rows="5" id="info"></textarea>
<br>
Medium or Researchers name: :
<input name="medium_na me" type="Text" id="medium_name " maxlength="30">
<br>
Place Name: :
<input name="place_nam e" type="Text" id="place_name " maxlength="50">
<br>
Date of Investigation:
<input name="date_deat h" type="text" id="date_death" >
<br>
Verified Event:
<input name="verified_ event" type="radio" value="radiobut ton">
Yes
<input name="verified_ event" type="radio" value="radiobut ton" checked>
No<br>
Event Closed:
<input name="closed_ev ent" type="radio" value="radiobut ton">
Yes
<input name="closed_ev ent" type="radio" value="radiobut ton" checked>
No<br>
<input type="Submit" name="submit" value="Enter information">
</p>
</form>
<?php
} // end if
?>
</body>
</html>
I really am a novice and found a script on webmonkey. Basically all I want
to do is to add records to my database. In my database I have a table called
research_main with the fields already created.
I have tried to bodge a script to work for me. it doesn't. It looks as
though it works but I get no data posted. What have I done wrong?
If you want me to put a statement in anywhere to check something please let
me know where you want me to put it as I really am useless with this.
can you tell me what is wrong with this script.
:-( I am trying honest
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect(" localhost", "uname", "password") ;
mysql_select_db ("dbtouse",$db) ;
$sql = "INSERT INTO research_main
(date_inv,info, medium_name,pla ce_name,date_de ath,verified_ev ent,closed_even t
) VALUES
('$date_inv','$ info','$medium_ name','$place_n ame','$date_dea th','$verified_ e
vent','$closed_ event')";
$result = mysql_query($sq l);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<p>Date Of Event:
<input name="date_inv" type="Text" id="date_inv">
<br>
Information to be researched:
<textarea name="info" cols="75" rows="5" id="info"></textarea>
<br>
Medium or Researchers name: :
<input name="medium_na me" type="Text" id="medium_name " maxlength="30">
<br>
Place Name: :
<input name="place_nam e" type="Text" id="place_name " maxlength="50">
<br>
Date of Investigation:
<input name="date_deat h" type="text" id="date_death" >
<br>
Verified Event:
<input name="verified_ event" type="radio" value="radiobut ton">
Yes
<input name="verified_ event" type="radio" value="radiobut ton" checked>
No<br>
Event Closed:
<input name="closed_ev ent" type="radio" value="radiobut ton">
Yes
<input name="closed_ev ent" type="radio" value="radiobut ton" checked>
No<br>
<input type="Submit" name="submit" value="Enter information">
</p>
</form>
<?php
} // end if
?>
</body>
</html>
Comment