Forum Moderators: coopster
<code>
<div align="center">PERSONALISE
<div id="trunks_front">
<div id="text_return"><?php if("$colour" == yellow):?><font color="#FFFF00"><?php echo $_POST[personalise];?></font><?php endif;?><br /></div>
</div>
</div>
<form method="POST" action="personalise.php">
<p>Type in the text as you would like to see it on your trunks.<br />
</p>
<p><input type="text" name="personalise" value="Enter your text here" onfocus="if(this.value == 'Enter your text here') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter your text here';}"/></p>
<p> Size of text
<select name="text_size">
<option value ="10">10pt</option>
<option value ="20">20pt</option>
<option value ="30" selected="selected">30pt</option>
<option value ="60">60pt</option>
</select>
Font style <select name="font">
<option value ="verdana">Verdana</option>
<option value ="trebuchet">Trebuchet</option>
<option value ="helvetica" selected="selected">Helvetica</option>
<option value ="arial">Arial</option>
</select>
Font colour <select name="colour">
<option value ="black">Black</option>
<option value ="white">White</option>
<option value ="red">Red</option>
<option value ="yellow" selected="selected">Yellow</option>
</select>
Brief colour <select name="brief_colour">
<option value ="black">Black</option>
<option value ="white">White</option>
<option value ="red" selected="selected">Red</option>
<option value ="yellow">Yellow</option>
</select>
<p><input type="submit" name="submit" value="Show me this text on my briefs"/></p></form>
<?php
$text_size = $_POST['text_size'];
$font = Trim(stripslashes($_POST['font']));
$colour = Trim(stripslashes($_POST['colour']));
$brief_colour = Trim(stripslashes($_POST['brief_colour']));
$yellow = yellow;
echo $text_size, $font, $colour, $brief_colour, $yellow;
?>
</code>
<?php
$text_size = $_POST['text_size'];
$font = Trim(stripslashes($_POST['font']));
$colour = Trim(stripslashes($_POST['colour']));
$brief_colour = Trim(stripslashes($_POST['brief_colour']));
$yellow = yellow;
echo "<p style=\"font:$font; background-color:$brief_colour; color:$colour; font-size:$text_size;\">\n
$yellow\n <!-- I take it this is your text to be written -->
<p>\n";
?>
You may want to change the <p> tag to something else, but this should give you what you want.
echo "<p style=\"font:Arial; background-color:#000; color:#fff; font-size:12px;\">\n
Testing, Testing, is this thing working\n <!-- $_POST['personalise'] -->
<p>\n";
Of course you will need to either echo the statment or strip out the php so that dreamweaver can look at the html.
Also I wouldnt bother with the validator built into dreamweaver...it isnt correct all of the time. Set up a test page then run it through -
[validator.w3.org...] for the markup and
[jigsaw.w3.org...] for the CSS
Although I got the link for your site, but remember that links to personal sites are going to get turned into example.com as soon as a mod notices.
<edit>
The quote of your code was there so that all you needed to do was take the quote and my code and use them in that order.
However you may want to trim or do other things to the input in $_POST['personalise'], however the resulting text from ['personalise'] needs to go in the space where I have testing, testing...
<edit 1>
<?php
$text_size = $_POST['text_size'];
$font = Trim(stripslashes($_POST['font']));
$colour = Trim(stripslashes($_POST['colour']));
$brief_colour = Trim(stripslashes($_POST['brief_colour']));
$yellow = 'yellow'; // dont know what this is
$text = $_POST['personalise'];
echo "<p style=\"font:$font; background-color:$brief_colour; color:$colour; font-size:$text_size;\">\n
$text\n
<p>\n";
?>
[edited by: PHP_Chimp at 1:00 pm (utc) on Dec. 5, 2007]
********
Font style <select name="font">
<option value ="Verdana">Verdana</option>
<option value ="Trebuchet">Trebuchet</option>
<option value ="Helvetica" selected="selected">Helvetica</option>
<option value ="Arial">Arial</option>
</select>
</code>
i changed the names to first letter capitals just in case but that didn't work.
any ideas?
echo "<p style=\"font-family:$font; background-color:$brief_colour; color:$colour; font-size:$text_size;\">\n
This still keeps all of your code in CSS, so this will work with all DTD's. As the font tag doesnt work with any strict DTD's.
Seeing as you are now getting into a long list of CSS you may well be better assigning an id to this <p> tag then applying the CSS to this id.
To apply CSS to an id you need to use -
p#my_id {border: 0; margin 0; padding 0;}
This code can go in the header of your page, or if you are attaching the style sheet then you can put this code into the external sheet. Or you can just add these tags to the style: attribute that you are already setting. If you are adding to the style attribute then you just need the code between the {}'s.