|
Posted by Robert on 05/22/07 02:21
connect.php (note: I have tried localhost)
***************************
<?php
$conn = mysql_connect("127.0.0.1:3306", "user_name", "password");
mysql_select_db("dbase_name", $conn);
?>
**************************
insert_names.php (html, to make it easier for humans)
**************************
<HTML>
<HEAD>
<TITLE>Insert Form</TITLE>
</HEAD>
<BODY>
<FORM ACTION="insert_data.php" METHOD=POST>
<P>Advertiser: <input type=text name="adv_name" size=20><P>
Contact: <input type=text name="cont_name"
size=20>
Title: <input type=text name="cont_title" size=20><P>Street:
<input type=text name="address" size=40>
Suite:
<input type=text name="apt" size=10><P>City:
<input type=text name="city" size=20> State:
<input type=text name="state" size=5> Zip:
<input type=text name="zip" size=10><br><br>
Notes:<P style="margin-top: 0; margin-bottom: 0">
<textarea cols="50" rows="12" name="notes"></textarea><p>
<input type=submit name="submit" value="Insert Record"></p>
</FORM>
</BODY>
</HTML>
*************************
insert_data.php (I have tried echoing output here and everything is blank)
*************************
<?php
include ("connect.php");
$sql = "INSERT INTO advertiser_tbl (adv_name, address, apt, city, state,
zip, notes) values ('$adv_name', '$address', '$apt', '$city', '$state',
'$zip', '$notes')";
echo $sql;
if (mysql_query($sql, $conn)){
echo "record added!";
} else {
echo "something went wrong";
}
?>
I can get this working locally on my Windoze and Linux installations.
When I try it on my friend's server, nothing but the defaults are put in
to the database. All fields except those with defaults and
autoincrement primary are blank. Any clues?
Thanks.
Robert
Navigation:
[Reply to this message]
|