Menu

Prepopualate field via url

Help
Steve
2007-10-31
2013-06-03
  • Steve

    Steve - 2007-10-31

    Is is possible to pre-populate a field from the url the page is loaded from. eg http://mysite.com/phpform/form1.html?phone=5555555555 ?

     
    • TNTEverett

      TNTEverett - 2007-10-31

      No, and Yes.

      No it is not designed this way.
      Yes it is possible to modify the processor.php to accept this type of input.

       
    • Steve

      Steve - 2007-11-01

      I'm not programmer, but I'm willing  to give it a try. Any tips?

       
      • TNTEverett

        TNTEverett - 2007-11-01

        1.) Your form has to become a php file, form.php
        2.) Inside the form you can prepopulate (default values) input fields such that the form shows the value you add in the URL to the displayed form field.

        <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
        <font face="Verdana">
        <?php
        echo "<input type=text name='lastname' value='".$_GET['lname']."' >";
        ?>
        </td>

        Do something similar to any or all input fields.  If none of the field variables are in the URL, the form works as it did before. 

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.