Evanthes Posted August 10, 2006 Share Posted August 10, 2006 Hey all Ive been trudging along on somewhat of a cms and ive made a page that i want to have records from the database load into a few select fields so that the user wont have to type those in when theyre entering new data. However what i think should work isnt even coming up. for some reason my textboxes are just normal blank ones without my info in it.anyways heres my function:[code=php:0]function addnew(){ echo '<tr><td>'; echo "<textarea name=id rows=0 cols=25>$searchterm</textarea>"; echo '</td>'; echo "<td>"; echo "<textarea name=comments rows=0 cols=25>N/A</textarea>"; echo '</td><td>'; echo "<textarea name=date rows=0 cols=25>".$today."</textarea>"; echo '</td>'; echo '</tr>';}[/code]both $today and $searchterm are working fine just not in that function.I bet its something like concatenation but ive been messing with that and cat get it to work. thanks for any help you guys can lend Link to comment https://forums.phpfreaks.com/topic/17170-should-be-easy-formatting-question/ Share on other sites More sharing options...
Jocka Posted August 10, 2006 Share Posted August 10, 2006 [code]global $today, $searchterm;[/code]put it at the top of the function Link to comment https://forums.phpfreaks.com/topic/17170-should-be-easy-formatting-question/#findComment-72709 Share on other sites More sharing options...
mewhocorrupts Posted August 10, 2006 Share Posted August 10, 2006 If I understand correctly, you're going to need to add every variable that your referencing in that function to the parameter list, like so:[code]<?phpfunction addnew($searchterm, $today){ echo '<tr><td>'; echo "<textarea name=id rows=0 cols=25>$searchterm</textarea>"; echo '</td>'; echo "<td>"; echo "<textarea name=comments rows=0 cols=25>N/A</textarea>"; echo '</td><td>'; echo "<textarea name=date rows=0 cols=25>".$today."</textarea>"; echo '</td>'; echo '<tr>';}?>[/code] Link to comment https://forums.phpfreaks.com/topic/17170-should-be-easy-formatting-question/#findComment-72711 Share on other sites More sharing options...
Evanthes Posted August 10, 2006 Author Share Posted August 10, 2006 just [quote author=Jocka link=topic=103765.msg413459#msg413459 date=1155242268][code]global $today, $searchterm;[/code]put it at the top of the function[/quote] it worked, i really appreciate it! Link to comment https://forums.phpfreaks.com/topic/17170-should-be-easy-formatting-question/#findComment-72712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.