ok thanks dear again

Member Avatar for LastMitch

@raovinesh

Try this again

<?php
include_once('config.php');
//post data to server
if ($_POST){
$globe_id = $_POST['globe_id'];
$cat1 = $_POST['cat1'];
$name = $_POST['name'];
// Put data into table
$query = mysql_query("INSERT INTO globes (globe_id, cat1, name) VALUES ('$globe_id', '$cat1', '$name')") or die (mysql_error());
}
// Get ID from browser
$sql = "SELECT id FROM globes WHERE name='$globe_id'";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
$globe_id=$_GET['globe_id'];
header("location: globe_welcome.php?globe_id=".urlencode($globe_id));
echo $globe_id;
?>

I really got to go. Test it out.

ok dear you may go. Again here is same issue of id. I am trying to solve.
Thanks for your assistance.

Member Avatar for LastMitch

@raovinesh

Can you provide your table

A table is something like this:

CREATE TABLE 'yourtable' (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `contents` text NOT NULL,
  PRIMARY KEY(`id`)
);

I need to create a table same as your so I can understand it better. Last night, I did everything in my head so it will be much easier if I can see what you are doing to make this work.

CREATE TABLE 'globes' (
globe_id int(250) NOT NULL auto_increment,
name varchar(200) NOT NULL,
PRIMARY KEY(globe_id)
);

table is like this

Member Avatar for LastMitch

@raovinesh

table is like this

CREATE TABLE 'globes' (
globe_id int(250) NOT NULL auto_increment,
name varchar(200) NOT NULL,
PRIMARY KEY(globe_id)
);

This is wrong. This is not how to create a table. I think I realized that you are not connected to the db because the table you have doesn't have cat1

Your table globes should have 3 category

$globe_id = $_POST['globe_id'];
$cat1 = $_POST['cat1'];
$name = $_POST['name'];

Read this first than follow the instructions on how to create a table:

http://www.w3schools.com/sql/sql_create_table.asp

Then come back with correct table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.