PDA

View Full Version : Strange PHP issue, pretty basic.



JoshuaJonah
February 24th, 2006, 09:40 AM
ok... i'm starting to freak out here.

I have this in a php file:

<?php
$news1 = "client fills out a form with his info, submits it and than I receive email saying you've received email from Mike below is Mike's info along with 2 buttons (links) to Approve or disaprove";
$news2 = "either way, I can use both. this on eits probably for email. Client info. but if you have for database than I need way way more sophisticated one. something like this";
$news3 = "when user fills outs a form it will also generate a login name and password for him for a login page where heshe can access additional information such as a budget, presentations, marketing tools etc.";
echo 'total=3&total=3&news1='.$news1;
?>
btw, yeah i just copy and pasted some text from the forums..:)

And i have this in AS:


news.onLoad = function() {
var i:Number = 1;
while (i<=news.total) {
var prev:Number = 0;
if (i==1) {
prev = 0;
} else {
prev = i-1;
}
news_mc.createEmptyMovieClip("article"+i,400+i);
news_mc["article"+i]._y = (news_mc["article"+prev]._y)+(news_mc["article"+prev]._height)+30
news_mc["article"+i].createTextField("date"+i, 501+i, 10, 0, 80, 20);
news_mc["article"+i]["date"+i].text = "SomeDate";
news_mc["article"+i].createTextField("news"+i, 601+i, 10, 20, 420, 40);
news_mc["article"+i]["news"+i].multiline = true
news_mc["article"+i]["news"+i].autoSize = "left";
news_mc["article"+i]["news"+i].html = true;
news_mc["article"+i]["news"+i].htmlText = news["news"+i];
i++;
}
}


and this is what i'm getting:
http://home.cogeco.ca/~jjonah/wow.jpg

JoshuaJonah
February 24th, 2006, 09:51 AM
ok update, my php appears to not like variables....hmm

<?php
$news1 = "client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove";

$news2 = "either way, I can use both. this on eits probably for email. Client info. but if you have for database than I need way way more sophisticated one. something like this";

$news3 = "when user fills outs a form it will also generate a login name and password for him for a login page where heshe can access additional information such as a budget, presentations, marketing tools etc.";

echo 'total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2='.$news2;
?>
http://home.cogeco.ca/~jjonah/wow001.jpg

JoshuaJonah
February 24th, 2006, 11:03 AM
bump

expensive_pen
February 24th, 2006, 11:06 AM
debug from the PHP and then from the flash, see what the actual page returns.

bwh2
February 24th, 2006, 11:07 AM
this should work:

<?php
...
echo 'total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2=$news2';
?>

but, i'm also interested to know if this will work:

<?php
...
echo 'total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2='.$news2.'';
?>

or if this will work:

<?php
...
echo 'total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2='.$news2.'\'';
?>

JoshuaJonah
February 24th, 2006, 11:14 AM
1. no.
2. no.
3. and no.

wow... this sucks. But so you know, other more complicated PHP scripts are working on my server fine...hmm

expensive_pen
February 24th, 2006, 11:15 AM
i don't really program in PHP too much, but it seems that the one you claim should work, should not because PHP will not interpolate variable inside single quotes

JoshuaJonah
February 24th, 2006, 11:16 AM
debug from the PHP and then from the flash, see what the actual page returns.
umm... it is just returning the literal variable, it's pretty clear.

skOOb
February 24th, 2006, 11:20 AM
what about

<?php
...
echo "total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2=$news2";
?>
i realize your code should work with the single quotes, that is weird. worth a shot though.

JoshuaJonah
February 24th, 2006, 11:21 AM
ummm. ok i have a breakthrough, but it's whacked.:S

This is what i get when i open the php in browser:

total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2=when user fills outs a form it will also generate a login name and password for him for a login page where heshe can access additional information such as a budget, presentations, marketing tools etc.

and im still getting the literal variable name in flash.... i think i'm gonna cry

JoshuaJonah
February 24th, 2006, 11:22 AM
what about

<?php
...
echo "total=3&total=3&news1=client fills out a form with his info, submits it and than I receive email saying youve received email from Mike below is Mikes info along with 2 buttons (links) to Approve or disaprove&news2=$news2";
?>
i realize your code should work with the single quotes, that is weird. worth a shot though.

and nope.

JoshuaJonah
February 24th, 2006, 11:26 AM
ok... next breakthrough, it works via browser but not locally when testing through flash...omg.

php: http://66.206.235.243:8080/demo/getnews.php
.fla: http://66.206.235.243:8080/demo/jj.fla
.swf: http://66.206.235.243:8080/demo/jj.swf

JoshuaJonah
February 24th, 2006, 11:29 AM
nevermind, it was an issue with calling the php as:

news.sendAndLoad("./getnews.php",news);
doesn't work


news.sendAndLoad("http://66.206.235.243:8080/demo/getnews.php",news);
does

JoshuaJonah
February 24th, 2006, 11:32 AM
i'm gonna go shoot people in BF2

bwh2
February 24th, 2006, 11:41 AM
i don't really program in PHP too much, but it seems that the one you claim should work, should not because PHP will not interpolate variable inside single quotes
word. i very rarely interpolate variables to begin with, so i tend to forget that. such is life.

JoshuaJonah
February 24th, 2006, 12:04 PM
so you guys know, umm... you can use variables inside sinle quotes in php 5:)