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 Quote Link to comment 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 Quote Link to comment 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] Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.