user1870124
user1870124

Reputation:

form action not working inside php class function

i have class promotions in class_promotions.php

class Promotion{ 

  function promotionForm(){ 

     <form method="post" action="  admin_panel.php?admin=admin-pro&admin=addpro   ">         
        Title: <input type="text" name="title" />        
        Description: <input type="text" name="des" />        
        <input type="submit" name="title" />     

     </form> 

  }    

  //and the 2nd function in same class is     
  function insertPromotions(){     
    //this function will get the val from admin_panel.php page and insert val to database
  }    

}    

as i submit that form in address bar link showing is

"admin_panel.php?title=field-val&des=field-val" 

but i need the link at the submission for form is something like

"admin_panel.php?admin=admin-pro&admin=addpro&title=field-val&des=field-val"

how to get that link after submitting that form, from that specific function

Upvotes: 0

Views: 68

Answers (1)

naota
naota

Reputation: 4718

You can use hidden like this:

<form method="get" action="admin_panel.php">
<input type="hidden" name="admin" value="admin-pro"> 
<input type="hidden" name="foo" value="bar"> 

A document for hidden is here: http://www.w3schools.com/tags/att_input_type.asp

And if you would like to have your parameters append to your action url, you can use method="get".

<form method="get" action="admin_panel.php">

Hope this helps

Upvotes: 1

Related Questions