0

@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.

Edited by LastMitch: grammer

0

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

0

@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.

0

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

0

@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.

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.