i have 2 tables
domains_info and tb2
i have got the form working well and entering data into the database
here is the top of my page
<?php
$action = isset($_POST['action']) ? $_POST['action'] : "";
if($action=='create'){
//include database connection
include 'db_connect.php';
//write query
$query = "insert into domains_info
set
domain = '".$mysqli->real_escape_string($_POST['domain'])."',
domain_account = '".$mysqli->real_escape_string($_POST['domain_account'])."',
renew_date = '".$mysqli->real_escape_string($_POST['renew_date'])."'";
if( $mysqli->query($query) ) {
//if saving success
header("Location:domains.php");
}else{
echo "Database Error: Unable to create record.";
}
$mysqli->close();
}
here is the form
<select id="domain_account" name="domain_account" class="txtBox">
<option value="">-select-</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
i tried and changed the top of my page like this
<?php
$action = isset($_POST['action']) ? $_POST['action'] : "";
if($action=='create'){
//include database connection
include 'db_connect.php';
//write query
$query = "insert into domains_info
set
domain = '".$mysqli->real_escape_string($_POST['domain'])."',
domain_account = '".$mysqli->real_escape_string($_POST['domain_account'])."',
renew_date = '".$mysqli->real_escape_string($_POST['renew_date'])."'";
if( $mysqli->query($query) ) {
//if saving success
header("Location:domains.php");
}else{
echo "Database Error: Unable to create record.";
}
$mysqli->close();
}
$query = "select id, data
from tb2
where id='".$mysqli->real_escape_string($_REQUEST['id'])."'
limit 0,1";
$result = $mysqli->query( $query );
$row = $result->fetch_assoc();
$id = $row['id'];
$data = $row['data'];
and updated my form as this
<select id="domain_account" name="domain_account" class="txtBox">
<option value="">-select-</option>
<option value="<?php echo$data; ?>"><?php echo$data; ?></option>
</select>
as you can tell i am very new to this and its not working.
sorry i didnt explain what i was trying to achieve, i am trying to display a drop down form with data from a database.