I have a template for my ebay auctions. I want to make a form that I can type in the variable information (ie title, description, images) and generate the html script to include those variables.

Votes + Comments
sig-link-spammer and question recycling waste of space
8 Years
Discussion Span
Last Post by codejoust

If you want to keep away from PHP and the rest of the server-side languages you can use some simple javascript with regular expressions, or even embedding the variables.

Javascript Example -

<form onsubmit="pop()" action="#" id="inForm"> <input id="color" type="text" /></form> <textarea readonly="readonly" id="out"></textarea>
var color = document.getElementById('color');
var text = '<span style="color:'+color+';">Colored Text</span>';
document.getElementById('out').innerHTML = text;
document.getElementById('inForm').style.display = 'none';

PHP Example -

function get($var){
//Validation and filtering
$varI = $_GET[$var];
if ($varI.len() > 200){  }
else { 
echo(strip_tags($varI)); }

<div style="color:<?php get('color'); ?>"><?php get('name'); ?></div>

html for form

<form action="generate.php"><input name="color" type="text" /><br /><input name="name" type="text" /></form>

Hope that helps!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.