Page 1 of 1

newbie here: help me in simple php form

Posted: Fri Jul 31, 2009 4:04 am
by softya
I have made a simple form named test.php. This form is opened through other local page with certain parameters.(example 'item1' and 'forumid')
Following is the example link.
http://localhost/studygroup/test/test.p ... mesite.com

Following is code for test.php

Code: Select all

<?php 
$forum_login_id = ($_GET['forumid']);
$$item1 = ($_GET['item1']);
echo $item1;
echo $forum_login_id;
 ?>
<html>
<form action=test-page1.php method="post">
<td align="right" nowrap>
<label for=Forum_ID>forum ID:</label>
<input id="forum_login_id" class="survey_list" maxLength="96" size="27" type="text" name="forum_login" value="<? "$forum_login_id";?>" 
</td> <br><br>
<td><label for=item1>item1</label>
<input id="item1" class="survey_list" maxLength="96" size="27" type="text" name="item1" value="<? "$item1";?>" 
</td> <br>
<br>
<td align="right" nowrap>
<label for=Comments>Comments:</label>
<input id="comments" class="survey_list" value="" maxLength="100" size="75" type="textbox" name="comments" />
</td><br><td align="right" nowrap>
<input type="submit" name="btnSendForm" value="Send" /></tr>  
</form>
</html>
ScreenShot001.gif
ScreenShot001.gif (2.61 KiB) Viewed 216 times
Now what I am trying to do is fetching variable of url into the boxes and displaying the results.

However, I am unable to to this. Please see the code and guide me further.
Regards

Re: newbie here: help me in simple php form

Posted: Fri Jul 31, 2009 4:55 am
by marty pain
Close!

<input id="forum_login_id" class="survey_list" maxLength="96" size="27" type="text" name="forum_login" value="<? echo $forum_login_id;?>"

Try that.

Also, <? and not <?php, will only work if you have sort tags enabled in your PHP.ini file, so if it still doesn't work swap <? with <?php.