42376

How can I pass a parameter with submit button on form

Question:

I want to create the from that can change product data in mySQL made by PHP.<br /> and I have the key column that auto increment and specify each product. When i click to edit product link .it will pass the key values that i get from each product and link to editPage.php

$Key = $data['Key']; <a href=\"editPage.php?Key=".$Key."\">edit</a>

in editPage.php i get the key values from previous page and i want pass thisvalues to next page with submit form button.I attach Key values in action link.

<?$Key = $_GET["Key"];?> <form id="form2" name="form1" method="post" action="editWeb.php?Key=".$Key." \">

It don't work, Can I pass Key values with another ways. Tell me if you want more information Thanks!!:))

Answer1:

You need to echo the value.

<form id="form2" name="form1" method="post" action="editWeb.php?Key=<? echo $Key ?>"/>

You could also use a hidden input:

<form id="form2" name="form1" method="post" action="editWeb.php"/> <input type="hidden" name="Key" value="<? echo $Key ?>" />

Answer2:

you need to create a hidden input field and place that value in it. and then submit the form

<input type="hidden" id="Key" name="Key" value="<?=$Key ?>">

Answer3:

<form id="" name="form" method="get" action="page.php"/> <name="" input type="hidden" value=""> <input type="submit" value=""> </form>

GET->show hidden value on required page url.generally we use GET to pass values, it depend upon your requirement.

Recommend

  • ASP.NET MVC - Reusing Action Behaviors
  • clone/copy DOM element function not working properly
  • Selenium: Error comes using “if” to decide whether an element exists or not
  • Unmarshalling with multiple namespaces
  • How to get database credentials into a c# application without committing it to source code?
  • @Autowired for @ModelAttribute
  • Symfony2.1 form date field: Argument 1 passed to … must be an instance of DateTime
  • HTML code to upload images
  • Tinymce strips attributes on submit
  • View Paypal shopping cart contents on my site
  • How to validate a year I enter in textbox using jquery rule?
  • jquery code not working without breakpoint
  • IE10 strips out hashtag from the URL
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • jQuery: How to AJAXify WordPress Search?
  • Passing “get” parameters doesn't work, parameter not visible in the link
  • Creating a DropDownList
  • Who propagate bugfixes across branches (corporate development)?
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Button click event not firing in jQuery
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • JSON response opens as a file, but I can't access it with JavaScript
  • Scrapy recursive link crawler
  • Why value captured by reference in lambda is broken? [duplicate]
  • req.body is undefined - nodejs
  • Join two tables and save into third-sql
  • Convert array of 8 bytes to signed long in C++
  • Display Images one by one with next and previous functionality
  • Upload files with Ajax and Jquery
  • Web-crawler for facebook in python
  • Do I've to free mysql result after storing it?
  • A cron job substitute?
  • json Serialization in asp
  • Understanding cpu registers
  • Why joiner is not used after Sequence generator or Update statergy
  • Recursive/Hierarchical Query Using Postgres
  • Running Map reduces the dimensions of the matrices
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal