views:

88

answers:

2

Hi, 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.

+1  A: 

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?

inkedmn
Hey, that's what I had originally, but I was afraid the php was messing it up so I tried generating everything from php, unfortunately that wont solve it. Thank you
Marvin
A: 

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.

Marvin
You should mark this as the correct answer if it's what worked for you.
donut