i have created an ol form and all its details are stored in a text file
i want to display these records in the form of the table on another webpage
any suggestions??

Recommended Answers

All 5 Replies

If you mean to copy the contents of a text file into a webpage then the file_get_contents() function should do the trick. Below is an example:

<?
$data=file_get_contents('filename.txt'); //get data from file
$dat=explode("\r\n",$data); //split data at new lines
echo '<table border=1 cellpadding=3 cellspacing=0>';
foreach ($dat AS $val) { //loop
echo '<tr><td>'.$val.'</td></tr>'; //display
}
echo '</table>';
?>

The above example will display every line of the text file in a new table row. Hope that helps.

thanks i used fgets() for my purpose
i have added a coloumn containing radio buttons to my table
any idea how can i link this so that on clicking on this radio button the entire row is selected??

I have managed to come up with the following but will try and improve it for you.

<script>function javascripthighlight(var1) {
document.getElementById(var1).style.backgroundColor = '#FF0000';
}
</script>
<table id='tablee'><tr id="tr0">
<td>column</td>
<td>radio button</td>
</tr><tr id="tr1">
<td>aaa</td>
<td><input type="radio" onclick="javascripthighlight('tr1')"></td>
</tr><tr id="tr2">
<td>bbb</td>
<td><input type="radio" onclick="javascripthighlight('tr2')"></td>
</tr><tr id="tr3">
<td>ccc</td>
<td><input type="radio" onclick="javascripthighlight('tr3')"></td>
</tr></table>

there are 10 rows in my table
wont it be bettr to write this using a loop?
can u suggest something??

Update, I have managed to solve it with the following script:

<script>var row="tr0";
function javascripthighlight(var1) {
document.getElementById(row).style.backgroundColor = '#FFFFFF';
document.getElementById(var1).style.backgroundColor = '#FF0000';
row=var1;
}
</script>
<table><tr id="tr0">
<td>column</td>
<td>radio button</td>
</tr><tr id="tr1">
<td>aaa</td>
<td><input type="radio" onclick="javascripthighlight('tr1')"></td>
</tr><tr id="tr2">
<td>bbb</td>
<td><input type="radio" onclick="javascripthighlight('tr2')"></td>
</tr><tr id="tr3">
<td>ccc</td>
<td><input type="radio" onclick="javascripthighlight('tr3')"></td>
</tr></table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.