Jump to content

[SOLVED] Easy Form Question!!! Please Help!


snowman15

Recommended Posts

Basically I just want to have the default value of a text feild in a form to be whatever is in a .txt file.

 

I have

 

<form action="http://www.*******.com/text2.php" method="post"> 
words: <input name="words" type="text" /> 
<input type="submit" value="submit" name="submit"/>

 

 

 

I just want the "value" (i think) to be whatever is inside testing.txt (same directory)

 

 

 

I was thining i would do a $variable=fread() and then value=$variable BUT the form is inside of a .html file so how would i make a php variable?

 

Any suggestions?

Link to comment
Share on other sites

Well you may have to save the file as .php

 

<form action="http://www.*******.com/text2.php" method="post"> 
words: <input name="words" type="text" value="<?php echo file_get_contents("text.txt"); ?>" /> 
<input type="submit" value="submit" name="submit"/>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.