Jump to content

Passing Form Fields through URL


Wildhalf

Recommended Posts

Hi,

What i am trying to do is wass a value ( 54292kg ) to a form on someone else's website. This site collects 3 things Your name, your email and a code ( 54292kg is my code).  I want to fill in the code for the user.

Is this possible???

I could even have a different webpage that sends the user to this page if needed
Link to comment
https://forums.phpfreaks.com/topic/27636-passing-form-fields-through-url/
Share on other sites

mgallforever's code is a good example. The 'receiving' page/form needs to grab the code from the URL using the $_GET parameter which then sets the value for the $code variable. Then, in their form code, they populate the field with the variable:

[quote]Code: <input type=text name=code value=$code>[/quote]

To pass the code you'd need in your form script (in the action="yourscript.php") the command to do that. Probably a 'header' function similar to:

[code]<?php
header("Location: http://www.theirsite.com/formpage.php?code=54292kg")
?>[/code]

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.