Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic forms in php

New Here ,
Apr 06, 2011 Apr 06, 2011

I'm trying to populate a drop down box in a form(form2) dynamically using a form variable from a different form(form1) on the same php page. does anyone know what i should set the action as for form 1 so that when form 1 is submitted form 2 is populated from the form variable? Any advice is appreciated.

TOPICS
Server side applications
406
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 08, 2011 Apr 08, 2011

Your could use either method, POST or GET.   <form action='' method="post">

Then put code such as the following somewhere, probably above the forms.

if ($_POST['name_of_form_one_submit']){

$variable1 = $_POST['variable1'];

}

Then your dropdown in form2 will dynamically be populated with the variable as follows:

<select name='drop_down_variable_name'>

option value= "<?php echo $variable1 ?>"><?php echo $variable1 ?></option>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 13, 2011 Apr 13, 2011
LATEST

Thanks for the answer. I have a similar problem. Going to try this out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines