Forum Moderators: open
That's basically all there is to it. Is there something in particular that you need help with?
<?php
include "dbaconnect.php" ;
$i =0;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Insert form</title>
<META NAME="keywords" CONTENT="Insert">
<META NAME="description" CONTENT="Insert">
<link rel="stylesheet" type="text/css" href="./css/home-font2.css"/>
<link rel="stylesheet" type="text/css" href="./css/home2.css" />
<link rel="stylesheet" type="text/css" href="./css/footer2.css" />
<script src="selectuser.js"></script>
</head>
<body>
<div id="banner">Insert</h1></div>
</div>
<div id="centercontent">
<h1> </h1>
<form action="insert2.php" method="post">
<table>
<tr><td>
seoid
</td><td>
<input type="text" name="pageid" />
</td></tr>
<tr><td>
keywordid
</td><td>
<input type="text" name="divid" />
</td></tr>
<tr><td>
Country
</td><td>
<?php
$sql1="SELECT * FROM country ORDER BY country";
$query1 = mysql_query($sql1);
echo '<select name="users" onchange="showUser(this.value)"';
while
($row1 = mysql_fetch_array($query1))
{
$i;
echo '<option value="',$row1['country'],'">',$row1['country'] ,'</option>';
$i++ ;
}
echo '</select>';
?>
</td></tr>
<tr><td>
</td></tr>
<tr><td>
cityid
</td><td>
<p>
<div id="txtHint"><b></b></div>
</p>
</td></tr>
<tr><td>
url
</td><td>
<input type="text" name="url" />
</td></tr>
<tr><td>
name
</td><td>
<?php
$sql="SELECT * FROM name";
$query = mysql_query($sql);
echo '<select name="cntry" style="width:200px" >';
while
($row = mysql_fetch_array($query))
{
$i;
echo '<option value="',$row['name'],'">',$row['name'] ,'</option>';
$i++ ;
}
echo '</select>';
?>
</td></tr>
</table>
<input type="submit" />
The following is the sql insert page after submit is pressed :
<?php
include "dbaconnect.php" ;
$sql="INSERT INTO test (continentid,countryid,cityid,url,name)
VALUES
('$_POST[continentid]','$_POST[users]','$_POST[myPrimarySelect]','$_POST[url]','$_POST[cntry]')
echo "$sql";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
so when i click submit the following is the result: (when i echo $sql )
INSERT INTO test (continentid,countryid,cityid,url,name)VALUES ('','America','New York','www.blah.com','south','hello','hiya','')1 record added
but when i look into the database i do not see the entry ? America and New York .
the ajax is working when i select x and a drop down of x derivatives occurs.
So my questions are the following :
1.Do i need more ajax to send the data
as per you instruction above ?
I dont know if this is a problem but i have php and ajax in the same form and would like to send both into one row in the database that is where my problem lies ?
The ajax is pretty identical to the w3schools ajax example in php .
if you want it i can post it but that is more for retrieving data not sending data ?
Im gonna work on it today , i will try find a solution before the us wakes up .
Regards
Malcolm
[edited by: Fotiman at 12:05 pm (utc) on Sep. 12, 2008]
[edit reason] Fixed bolds [/edit]