1

I know how to pass data to another page with Get method as hiperlink:

{echo "<a  href=file.php?variable1=".$row['value1']."&variable2=".$row['value2']."'>Confirm</a>"; }

How add value from input field in this lane above? Is it possible?

<input name="field_name"  type="text" >
2
  • you search for a <form> or javascript to do this Commented Jan 7, 2015 at 11:44
  • <input name="field_name" type="text" value="<?php echo $_GET['variable1']; ?>" > Commented Jan 7, 2015 at 11:44

4 Answers 4

1

Try this way:

{echo "<a  href=file.php?variable1=".$row['value1']."&variable2=".$row['value2']."&field_name=".$_GET['field_name']."'>Confirm</a>"; }
Sign up to request clarification or add additional context in comments.

Comments

1

In this case use $_GET['field_name'] in your php code to add value of the input field

For eg:

<input name="field_name1"  type="text" >
<input name="field_name2"  type="text" >

{echo "<a  href=file.php?variable1=".$_GET['field_name1']."&variable2=".$_GET['field_name2']."'>Confirm</a>"; }

Comments

1

Depending on the value of the method attribute in your form, the input's value would be passed to PHP via either the $_POST or the $_GET array. You can link this to PHP via the following code:

{echo "<a  href=file.php?variable1=".$_GET['field_name']."&variable2=".$row['value2']."'>Confirm</a>"; }

Please note that the form should be submitted first before this code is executed. If this is not desirable, you should probably use JavaScript.

Comments

0
{echo "<a  href=file.php?variable1=".$row['field_name']."&variable2=".$row['field_name_etc']."'>Confirm</a>"; }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.