Forum Moderators: coopster

Message Too Old, No Replies

Variable wont show in echo!

driving me insane

         

smatts9

10:23 pm on Jul 14, 2006 (gmt 0)

10+ Year Member



<?
session_start();
if (isset($_COOKIE['id']))
{
$forumid = $_REQUEST['forumid'];

echo '
<form name="form1" method="post" action=url.php?id=$forumid>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td align="left" valign="top">Title:</td>
<td><input name="title" type="text" id="title" value=""></td>
</tr>
<tr>
<td align="left" valign="top">Message:</td>
<td><textarea name="topictext" id="message" cols="40" rows="10" size="40" value="<br><br><br><br><br>" tabindex="10080"></textarea></td>
</tr>
<tr>
<INPUT type="hidden" name="forumid"
value="$forumid">
<td align="left" valign="top">&nbsp;</td>
<td><input type="submit" name="Submit" value="Add Topic"></td>
</tr>
</table>
</form>
';
}
else
{
header('URL');
exit();
}
?>

In the form action= part, it wont input to requested value $forumid, it just stays as $forumid? I can't figure this one out. THanks.

eeek

10:25 pm on Jul 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Within single quotes (i.e. ') you don't get $var substitutions.

smatts9

10:29 pm on Jul 14, 2006 (gmt 0)

10+ Year Member



Well using " " I get:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on line 8?

Is there another way to accomplish this?

eeek

10:40 pm on Jul 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You either have to escape all the internal " characters or break the string up.

jatar_k

10:48 pm on Jul 14, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



just escape from php and then go back in

watch this

<?
session_start();
if (isset($_COOKIE['id']))
{
$forumid = $_REQUEST['forumid'];
?>
<form name="form1" method="post" action=url.php?id=<? echo $forumid;?>>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td align="left" valign="top">Title:</td>
<td><input name="title" type="text" id="title" value=""></td>
</tr>
<tr>
<td align="left" valign="top">Message:</td>
<td><textarea name="topictext" id="message" cols="40" rows="10" size="40" value="<br><br><br><br><br>" tabindex="10080"></textarea></td>
</tr>
<tr>
<INPUT type="hidden" name="forumid"
value="<? echo $forumid;?>">
<td align="left" valign="top">&nbsp;</td>
<td><input type="submit" name="Submit" value="Add Topic"></td>
</tr>
</table>
</form>
<?
}
else
{
header('URL');
exit();
}
?>