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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.