Auto-filled Form Fields with URL Query?
Hi All,
Is it possible to auto fill the form fields with a URL string query?
For example
www.homepage.html?name1=Frank&name2=Sinatra
I have been trying this without success.
Have you managed this with a Web Form Builder form?
Any tips or suggestions?
Thanks,
Daniel
Is it possible to auto fill the form fields with a URL string query?
For example
www.homepage.html?name1=Frank&name2=Sinatra
I have been trying this without success.
Have you managed this with a Web Form Builder form?
Any tips or suggestions?
Thanks,
Daniel
Hi Daniel,
Yes this can be done with a little alteration after exporting your form to your own host. You'll also need to setup your host to parse php inside html pages or change your page extensions to .php.
Here's what you need to do as a small example.
Put this at the top of your page that has the iframe code for your form.
I'm using name and number for my variables as an example.
Adjust your iframe code to look similar to this.
Put this code at the top of your form.html page.
Adjust the inputs by adding a value attribute.
Here's my input with the name.
Here's my input with the number.
Working here.
https://ericrohloff.com/coffeecup/ccforum/formbuilder/fill-from-url-var/?name=Tom&number=23
Yes this can be done with a little alteration after exporting your form to your own host. You'll also need to setup your host to parse php inside html pages or change your page extensions to .php.
Here's what you need to do as a small example.
Put this at the top of your page that has the iframe code for your form.
I'm using name and number for my variables as an example.
<?php
if(isset($_GET['name'])){
$name = $_GET['name'];
}
if(isset($_GET['number'])){
$number = $_GET['number'];
}
?>
if(isset($_GET['name'])){
$name = $_GET['name'];
}
if(isset($_GET['number'])){
$number = $_GET['number'];
}
?>
Adjust your iframe code to look similar to this.
<?php
echo '<iframe height="364" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="fill-from-url-var/fill-from-url-var.html?name='.$name.'&number='.$number.'">
</iframe>';
?>
echo '<iframe height="364" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="fill-from-url-var/fill-from-url-var.html?name='.$name.'&number='.$number.'">
</iframe>';
?>
Put this code at the top of your form.html page.
<?php
if(isset($_GET['name'])){
$name = $_GET['name'];
}
if(isset($_GET['number'])){
$number = $_GET['number'];
}
?>
if(isset($_GET['name'])){
$name = $_GET['name'];
}
if(isset($_GET['number'])){
$number = $_GET['number'];
}
?>
Adjust the inputs by adding a value attribute.
Here's my input with the name.
<input name="text" id="item1_text_1" type="text" maxlength="254" placeholder=""
autocomplete="off" data-hint="" value="<?php if(isset($name)){echo $name;}?>" />
autocomplete="off" data-hint="" value="<?php if(isset($name)){echo $name;}?>" />
Here's my input with the number.
<input name="number" id="item2_number_1" type="number" min="0" max="999999999"
step="1" autocomplete="off" data-hint="" value="<?php if(isset($number)){echo $number;}?>" />
step="1" autocomplete="off" data-hint="" value="<?php if(isset($number)){echo $number;}?>" />
Working here.
https://ericrohloff.com/coffeecup/ccforum/formbuilder/fill-from-url-var/?name=Tom&number=23
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Hi Eric,
Thank you for an excellent and informative answer!
Since I posted the question I was experimenting with JavaScript to do this.
I much prefer this PHP approach.
Many thanks,
Daniel
Thank you for an excellent and informative answer!
Since I posted the question I was experimenting with JavaScript to do this.
I much prefer this PHP approach.
Many thanks,
Daniel
I can do the same with JS if needed. Post back if you need more info.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Will do... and I may!
Thanks Eric.
Thanks Eric.
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.