Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prepopulate Form From A URL

    I have found various answers on the internet but none of them seem to work

    When i follow a URL to my form page i need a field to have the product already filled out. no matter what i tried it never populates the field.

    I have tried the following

    http://www.yourcaketopper.co.uk/cont....php?name=mark

    The form name is called contactform
    The ID field is called name

    Is there anything special i need to do to make it work or is it not possible.

    Your help is very much appreciated in advance.

    Thank You Very Much
    Mark

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Is there anything special i need to do to make it work or is it not possible.
    Where's your code ? The following should work.
    PHP Code:
    <input type="text" name="somename" value="<?php echo $_GET['name']?>">
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm really sorry for me being pretty vague, where do i put your response?

    My scenario is i have 4 options when a customer clicks on a picture it will put the picture id in the required box on the form, this isn't the actual form yet i want to use the hyperlink that way it saves me setting hundreds of paypal buttons i can use just 1 using a different ref number.

    I am truly sorry if i am being awkward i'm just newish to this

    I truely appreciate your help

    Mark

  • #4
    Regular Coder jdswebservice's Avatar
    Join Date
    Aug 2010
    Location
    Moon Township, PA
    Posts
    107
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Resolved

    You'll probably want to do an OnClick on the image and use javascript to generate putting the value into the form input tag.

    code is below.

    Code:
    <html>
    <head>
    	<title>
    		Post ID: 266216
    	</title>
    	<script type="text/javascript">
    	function changeValue(value) {
    		document.getElementById('myField').value=value;
    	}
    	</script>
    </head>
    <body>
    
    
    <img src="" width="100" height="100" onclick="changeValue('value1')">
    <br>
    <br>
    <img src="" width="100" height="100" onclick="changeValue('value2')">
    <br>
    <br>
    <img src="" width="100" height="100" onclick="changeValue('value3')">
    <br>
    <br>
    <img src="" width="100" height="100" onclick="changeValue('value4')">
    <br>
    <br>
    <input type="text" name="myField" id="myField">
    <br>
    <br>
    <input type="submit" value="****s and Giggles Submit Button">
    
    
    </body>
    </html>
    Copy and paste that into a new HTML file and you'll have what you want!

    Happy Coding!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •