Jump to content

form action call php class


project-nz

Recommended Posts

hi hows it going my problem is:

 

when ever i run the following code it runs the

code inside the "action =" php statement at the same time

 

isnt it supposed to run php code when i click

on the submit button? im confused

 

<body>

    <?php

    // pre full db
    include('PreDB.php');
    $predb = new PreDB();

    ?>

    <center>
    <form method = "post" action= '<?php
                        include ("Listings.php");
                        $obj = new Listings("order1", $result);
                        
                        ?>' >
    
           <input type=text name="listname" />
           <input type=submit value="Search">
           
    </form>
    </center>

    </body>

Link to comment
https://forums.phpfreaks.com/topic/157925-form-action-call-php-class/
Share on other sites

Forms only exist in the browser. The action="..." parameter is the URL of the form processing code that the browser submits the form data to. You must put a URL in the action="..." parameter (an empty value refers to the same URL as the current page.)

Forms only exist in the browser. The action="..." parameter is the URL of the form processing code that the browser submits the form data to. You must put a URL in the action="..." parameter (an empty value refers to the same URL as the current page.)

 

thanks for the quick answer

is there anyway around this, itll be less efficient if i have to call a .php file

then within that php file call the class i wanted?

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.