Re: [misery217] Inserting List data into form automatically
Hi misery217,
This is a bit outside the scope of CMS Builder support but here's some tips:
- You can pass values in the url like this: ?name=value
- If you're passing a value from CMS Builder you'll want to url encode it. Instead of <?php echo $record['field'] ?> you'd use <?php echo urlencode($record['field']) ?>
- So your link might look like this:
index.html?product=<?php echo urlencode($record['product']) ?>
- Now, in order to read that value back you're going to need to switch index.htm to index.php.
- Then you could display that value in the field by default like this:
<input name="product" type="text" id="product" size="45"
value="<?php echo htmlspecialchars(@$_REQUEST['product']) ?>" />
A few explanations. urlencode() encodes things like space as %20 or + so they work in your urls. Same as you see when you submit a google search where some characters get encoded.
htmlspecialchars() encodes special characters as "html entities" so " becomes " so if your product value had a " in it it wouldn't break your text field (which uses quotes around the value).
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com