kanie12 Posted June 25, 2007 Share Posted June 25, 2007 Hi. I'm having trouble getting a variable($text) to be filled into a form field. I think its because of the form being outside the php tag but im not sure. Hope someone can help. Here is the code: <?php require_once("funksjoner.php"); topp(); topp_meny(); $Choo = new mysql(); $Choo->connect(); $result = $Choo->query("SELECT * FROM `kunde` WHERE kunde_id=1"); $row = mysql_fetch_row( $result ); $text=($row[1]); ?> <div id='kundeinfo'> <form action="form.php" method="post"> <table width="236" border="0" align="center"> <tr> <td width="78"><div align="left">Fornavn:</div></td> <td width="148"><div align="center"> <input type="text" value='$text'/> </div></td> </tr> <tr> <td><div align="left">Etternavn:</div></td> <td><div align="center"> <input type="text" name = "etternavn" /> </div></td> </tr> <tr> <td><div align="left">Gatenavn:</div></td> <td><div align="center"> <input type="text" name = "gatenavn" /> </div></td> </tr> <td><div align="left">Postnr:</div></td> <td><div align="center"> <input type="text" name = "postnummer" /> </div></td> </tr> <td><div align="left">Telefon:</div></td> <td><div align="center"> <input type="text" name = "telefonnr" /> </div></td> </tr> <td><div align="left">Mobil:</div></td> <td><div align="center"> <input type="text" name = "mobi" /> </div></td> </tr> <td><div align="left">Epost:</div></td> <td><div align="center"> <input type="text" name = "epost" /> </div></td> </tr> <td><div align="left">Passord:</div></td> <td><div align="center"> <input type="text" name = "passord" /> </div></td> </tr> <tr> <td><div align="left">Kundeid:</div></td> <td><div align="center"> <input type="text" name = "kunde_id" /> </div></td> </tr> </table> <br><br><br> <div align="center"> <input type="submit" value="Lagre"> <input name="Reset" type="reset" value="Nullstill" /> </div> </form></div> Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 25, 2007 Share Posted June 25, 2007 <input type="text" value='$text'/> should be <input type="text" value="<?php echo $text; ?>" /> Quote Link to comment Share on other sites More sharing options...
kanie12 Posted June 25, 2007 Author Share Posted June 25, 2007 thx Quote Link to comment Share on other sites More sharing options...
kanie12 Posted June 25, 2007 Author Share Posted June 25, 2007 The reset form button doesnt seem to work hmm ??? Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 25, 2007 Share Posted June 25, 2007 lower r ok <input name="reset" type="reset" value="Nullstill" /> Quote Link to comment Share on other sites More sharing options...
kanie12 Posted June 25, 2007 Author Share Posted June 25, 2007 I tried with echo. Reset only works for the text i type in :-\. Doesnt seem to be possible to remove prefilled text Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.