Variables problems

my problem: i have 2 different pages. both doing the same thing. 1 is html, 1 is flash. I did this because i thought it was a flash problem. i am trying to take a variable from a flash movie and send it to a php page. ok 1st problem, i can’t get the variable to go thru, which you already know. then i decided to try an html page, instead of flash. that worked, so i guess it’s a flash problem. bu tthen i decided to take that variable from the phppage and insert in into my db, sicne i wil have to do this anyway for my mailing list. what happens is nuts. my php page displays the variable and says that 1 record was inserted into db. when i view the table in the db, it does recognize that something was entered just doesnt display it. so in other words, there in a blank entry. i am starting to think it is a server setting, but in another project this does work o the same server. here is my code

insertmail.php:


<html>
<head>
<title>Book-O-Rama Book Entry Results || Digitalosophy ||</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>mailign list</p>
<?
  $news   = $news;
  print "Your name is " . $news . ".";
  
  @ $db = mysql_pconnect("localhost", "USER_NAME", "PASSWORD");
  
  if (!$db){
  echo "Error: Could not connect to database.  Please try agian later.";
  exit;
  }
    mysql_select_db("digitalo_digitalosophy");
    $query = "insert into news(name) values('$mail')";
	$result = mysql_query($query);
	if ($result) {
		echo mysql_affected_rows()." book inserted into database.";
    }
  

?>
</body>
</html>

insert.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="insertmail.php" method="post">
<input type="text" name="news"><br>
<input type="submit">
</form>
</body>
</html>

flash action script:
[AS]
on(release){
getURL(“http://www.digitalosophy.com/insertmail.php",0,"post”);
}
[/AS]

news is the variable in both flash and html files.

sorry about the long post, and thanks in advance

First of all, remove your username and password from the code posted here !

Shouldn’t

$news   = $news;

be

$news   = $_POST['news'];

?

And I don’t get it, it seems to be that a part of the code is missing …

yeah what he said will work.

also, you don’t define the variable $mail anywhere… thats why its inputing a space into your databse. :wink:

There I fixed it. :slight_smile:

The code you were using was

$news = $_GET[‘news’];

I changed that to

$mail = $_POST[‘news’];

and then it insert into the database fine (from the Flash file). I deleted that entry from your db as well. :slight_smile:

*Originally posted by Voetsjoeba *
First of all, remove your username and password from the code posted here !

ya that would be a good idea.

*Originally posted by Jubba *
**There I fixed it. :slight_smile:

The code you were using was

$news = $_GET[‘news’];

I changed that to

$mail = $_POST[‘news’];

and then it insert into the database fine (from the Flash file). I deleted that entry from your db as well. :slight_smile: **

your right, i never defined what $mail was, it makes toltal sence that nothing was getting entered. you see jubba, I was so caught up in why I could pass variables, i never looked to see what i was defining, and what i wasn’t. so far this has been my biggest problem, defining varaibles. thanks again man.