Reputation: 513
im using MAMP on OSX 10.4.11 and while doing a form I came up with an issue:
<?php
$today = date("d.m.y");
echo "<div class=\"newpub\">
<form action=\"insert.php\" method=\"post\">
<span class=\"text\">Data</span><br><input type=\"text\" value=\"$today\" name=\"Date\" size=\"14\" height=\"1\"><br><br>
<span class=\"text\">Corpo</span><br><textarea rows=\"10\" cols=\"50\" name=\"Data\"></textarea><br><br>
<span class=\"text\">Imagem</span><br><input value=\"123\" type=\"text\" name=\"Image\" size=\"14\" height=\"1\"><br><br>
<span class=\"text\">Unique_id</span><br><input type=\"text\" name=\"unique_id\" size=\"14\" height=\"1\"><br><br>
<input type=\"Submit\" value=\"Publicar\">
</form>
</div>"
?>
On my first span the "value" doesn't show up, although it shows it on the page source, this problem goes away if I try it in my server, but since im developing this on my local machine and not always I have internet access this is an annoyance. Anyone encountered a similar problem? All the other fields display the "value" if one is assigned.
Thanks.
Upvotes: 0
Views: 333
Reputation: 513
Solved it, I had the page name as : mypage.PHP
I think caps lock is at blame :)
Anyway after renaming it to: mypage.php it now works as it should.
Upvotes: 0
Reputation: 28205
What if you changed your code to this:
<?php $today = date("d.m.y"); ?>
<div class="newpub">
<form action="insert.php" method="post">
<span class="text">Data</span><br><input type="text" value="<?php echo $today; ?>" name="Date" size="14" height="1"><br><br>
<span class="text">Corpo</span><br><textarea rows="10" cols="50" name="Data"></textarea><br><br>
<span class="text">Imagem</span><br><input value="123" type="text" name="Image" size="14" height="1"><br><br>
<span class="text">Unique_id</span><br><input type="text" name="unique_id" size="14" height="1"><br><br>
<input type="Submit" value="Publicar">
</form>
</div>
All that escaping and whatnot only makes the code more difficult to maintain.
Does that help?
Upvotes: 1