vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   help with dynamic population of textboxi (https://vborg.vbsupport.ru/showthread.php?t=79377)

twoseven 04-05-2005 12:16 AM

help with dynamic population of textboxi
 
PHP Code:

 $pulltemplate = mysql_query("SELECT id,name,content FROM templates");

<form action="list.php?do=edit" method="POST">
<select name="option">
<?PHP
while($row mysql_fetch_array($pulltemplate,MYSQL_NUM)) {

echo 
"<option value=\"$row[1]\">$row[1]</option>\n";

}
?>
</select>
<input type="Submit" name='$row[1]' Value="Edit" />
</form>

if($_REQUEST['do']=='edit'){

?>
<textarea rows="20" cols="50"><?php echo $pee?>  </textarea><?php
}?>

my question is how do i get the variable choosen $row[1] to pull the data when submit is clicked for the value located in the list
eg. if the list contains: a,b,c,d how would i pass the info in the variable to be able to edit the info.

akanevsky 04-05-2005 12:32 AM

I am sorry, but I do not completely understand what exactly do you want to pull, from where do you want to pull it, and where do you want to put it...

twoseven 04-05-2005 01:04 AM

PHP Code:

 $pulltemplate mysql_query("SELECT id,name,content FROM templates"); 

thought that was where i was pulling it from but anyhow an even longer explanation.
i'm pulling from a database (outside of my vb one) now i'm trying to read the names of the templates and get the content area of the name of the template to the text area.
if a name is: xxx and it holds: "your stuff here"
i want it to put "your stuff here" in the textbox which is where the variable $pee is right now
may be my lack of english here (even though i'm from the US)

akanevsky 04-05-2005 01:17 AM

I would suggest you do the following:

Replace
PHP Code:

while($row mysql_fetch_array($pulltemplate,MYSQL_NUM)) { 

with
PHP Code:

while ($row mysql_fetch_array($pulltemplate,MYSQL_ASSOC)) { 

And then, if the original query is

PHP Code:

$pulltemplate mysql_query("SELECT id,name,content FROM templates"); 

Then you can access the variables by:

PHP Code:

$row['id'], $row['name'], $row['content'



All times are GMT. The time now is 01:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01228 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete