Jump to content

Should be easy formatting question


Evanthes

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
Link to comment
https://forums.phpfreaks.com/topic/17170-should-be-easy-formatting-question/
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]

Archived

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

×
×
  • Create New...

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.