PDA

View Full Version : I think this is a simple question


74corvette
10-03-2007, 05:56 PM
Maybe some of you experienced coders can help me. I'm using the Form Hack mod on my forum and have changed the thread title to include one of the variables, $normalanswer1 so that the title reflects the answer. My question how can I add another variable ($radioanswer1) to that ? Heres the code:

$newpost['title'] =& $normalanswer1;

I have tried $normalanswer1.$radioanswer1, but that did do it. Quotes dont work either.

Signed,

PHP newbie

Opserty
10-03-2007, 07:26 PM
You mean like:

// $newpost['title'] = 'Something, ';
// $normalanswer = 'Another thing.';
$newpost['title'] .= $normalanswer;

// Now $newpost['title'] has the value: Something, Another thing.

I think thats what your asking, if not can you elaborate a little more?

74corvette
10-03-2007, 08:02 PM
Sorry for not give you enough info. I'll try again.

THE CODE IS
1. $foruminfo = verify_id('forum', $formforumid, 0, 1);
2. $forumperms = fetch_permissions($foruminfo[forumid]);
3. $newpost['username'] =& $vbulletin->userinfo['username'];
4. $newpost['message'] =& $formsend;
5. $newpost['title'] =& $normalanswer1; (put $radioanswer1 here)
6. $newpost['parseurl'] = '1';
7. $newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

all I want to do put 2 variables on line 5. The variable has already been defined I just want to display it along with $normalanswer1.....I've tryed just putting next to $normalanswer1 it it does not show up on the output. Make any sense ?

Opserty
10-03-2007, 08:32 PM
$normalanswer .= ' '. $radioanswer1;
$newpost['title'] =& $normalanswer1;

// OR

$newpost['title'] = $normalanswer1 . $radioanswer1;


Like that? :p

74corvette
10-03-2007, 08:44 PM
Thank you very much. That seems to work. I believe I tried earlier and it didn't work, the only difference being the before I had the "&" in there. Can you tell me & does ? Thanks for time btw.

Eikinskjaldi
10-04-2007, 02:20 AM
Thank you very much. That seems to work. I believe I tried earlier and it didn't work, the only difference being the before I had the "&" in there. Can you tell me & does ? Thanks for time btw.

& means pass by reference. So

$foo = 4
$bar = $foo
$bar = 6

print($foo) -> 4
print($bar) -> 6

$foo = 4
$bar = & $foo
$bar = 6

print($foo) -> 6
print($bar) -> 6