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> Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/ 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; ?>" /> Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/#findComment-281939 Share on other sites More sharing options...
kanie12 Posted June 25, 2007 Author Share Posted June 25, 2007 thx Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/#findComment-281945 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 ??? Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/#findComment-281946 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" /> Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/#findComment-281951 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 Link to comment https://forums.phpfreaks.com/topic/57065-phpforms/#findComment-281957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.