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.

Salem commented: sig-link-spammer and question recycling waste of space -6

Recommended Answers

All 2 Replies

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 -

<?php
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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.