Run PHP File On Button Click

65,810

To pass values between pages:

Main form:

<form action="myuploadform.php" method="get">
ID: <input type="text" name="id">
<input type="submit" value="Open Form">
</form>

The value of the ID text box will be accessible as $_GET['id'] in myuploadform.php.

Using GET parameters is the simplest way of passing values. Another way to pass in this GET value would be in the URL:

.../myuploadform.php?id=35 where the ID then becomes 35.

Share:
65,810
IRHM
Author by

IRHM

Updated on December 19, 2020

Comments

  • IRHM
    IRHM over 3 years

    I wonder whether someone could help me please.

    I've been looking through this, and many other sites and tutorials to find out how to add a button to a form which opens a PHP file, in this case, a pop up form that allows a user to upload a file to a mySQL database.

    In addition to the opening of the file, I'd like to carry over the 'id' field value from the main form to the pop 'File Upload' form.

    From the research I've carried out there seems to be a number of ways to do this, but from a beginners perspective I'm not sure what is the best way to do this.

    Could someone perhaps please advise on what is the best way to go about this.

    Many thanks and kind regards