开发者

filling the form in declared link

I have to declare an html link in my php file, i can do that in the following way

echo "<a href='razz.com'>Update</a>"; 

the link razz.com has a form fields(text type) in it, what i want to do is that when i open the link the form fields present in the link needs to be filled by the values that i declare in my initial php page.

the values of the form fields that needs to be filled are obtained from database.

How can i do that? Any tutorials or code snippet are appreciated.

Thank you.

开发者_运维技巧Code snippet of what i am looking for:

a user fills form information which needs to go into database for storage: the form is as follows:

<p>Title:<input type="text" name="title"/></p>
<p>Report No:<input type="text" name="rno"/></p>
<p>URL:<input type="text" name="url"/></p>

now after filling the form, the data will be stored in the database . A page with echo's successful with form information and a link to update the previously entered information will be displayed.

now again this update link contains the form structure , so instead of entering the information which was previously entered. the information already entered needs to be fetched and displayed in the form area.


You would need to use GET request parameters and the $_GET array on the page that is accepting the request to pass values to your link, but only if the http://razz.com/ index page actually accepts your URL parameters.

For instance (see the stuff and otherstuff GET keys in the URL):

echo "<a href='http://razz.com/?stuff=yes&amp;otherstuff=yadayada'>Update</a>"; 

Then the razz.com index(.php):

$stuff = $_GET['stuff']; // with the link above, equal to yes
$otherstuff = $_GET['otherstuff']; // with the link above, equal to yadayada

echo "
<h2>$stuff</h2>
<p>I got $otherstuff.</p>
";

This would echo on razz.com/index(.php):

<h2>stuff</h2>
<p>I got yadayada.</p>

You could also use the $_POST array, but this would require more work and you would need to have a reason to do this (such as the data you're passing is transitory). You could do this by triggering a form, which you could also do a GET request with.

However, your question is not really that well worded. If you can provide more context and direction, that would help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜