Jump to content

Archived

This topic is now archived and is closed to further replies.

Evanthes

Should be easy formatting question

Recommended Posts

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

Share this post


Link to post
Share on other sites
[code]
global $today, $searchterm;
[/code]
put it at the top of the function

Share this post


Link to post
Share on other sites
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]
<?php

function 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]

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.