# Variables problems

**URL:** <https://forum.kirupa.com/t/variables-problems/23901>\
**Category:** Uncategorized\
**Created:** [June 24, 2003, 3:34am UTC](https://forum.kirupa.com/t/variables-problems/23901 "2003-06-24T03:34:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 3:34am UTC](https://forum.kirupa.com/t/variables-problems/23901/1 "2003-06-24T03:34:15Z")

</div>

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:

```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

```php

<!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](http://www.digitalosophy.com/insertmail.php%22,0,%22post)”);  
}  
[/AS]

news is the variable in both flash and html files.

sorry about the long post, and thanks in advance

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 6:08am UTC](https://forum.kirupa.com/t/variables-problems/23901/2 "2003-06-24T06:08:28Z")

</div>

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

Shouldn’t

```php
$news = $news;

```

be

```php
$news = $_POST['news'];

```

?

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 6:12am UTC](https://forum.kirupa.com/t/variables-problems/23901/3 "2003-06-24T06:12:08Z")

</div>

yeah what he said will work.

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 6:21am UTC](https://forum.kirupa.com/t/variables-problems/23901/4 "2003-06-24T06:21:38Z")

</div>

There I fixed it. 🙂

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 4:02pm UTC](https://forum.kirupa.com/t/variables-problems/23901/5 "2003-06-24T16:02:52Z")

</div>

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

ya that would be a good idea.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 24, 2003, 4:05pm UTC](https://forum.kirupa.com/t/variables-problems/23901/6 "2003-06-24T16:05:07Z")

</div>

> \*Originally posted by Jubba \*  
> \*\*There I fixed it. 🙂

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. 🙂 \*\*

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.
