Jump to content

Echo: How to view/call data from separate file into echo


Defcon

Recommended Posts

Hye all,

 

I would like to ask about echo "<--statement==>";

 

Ok my senario let say like this i got a file name as datax01.php & script.php

 

Let say on script.php i got a code to use echo. So how from echo i can recall datax01.php to view on that script?

 

My theory is to use $ let say script like this

 

<?php

$data = "datax01.php";
echo "$data";
?>

 

I know my theory/code is wrong so how i can do that? My limitation in this issue is i must view/recall a data from echo.

 

Thanxs.

 

*datax01.php is containing a PHP script where to process a submit form and also PHP if..else syntax

www.php.net/file_get_contents  or  www.php.net/include  would be what you want.

 

Hye frost110, thanxs for reply. Currently what i know for file_get_contents only can call txt file. How bout PHP file such as datax01.php like i said? It is include can be recall inside echo? My limitation is i have to put it on echo because my real scenario currently that web base system(script.php) giving output with echo, so now i have to update it with process form on datax01.php to put on that echo. I cant using "include" unless it can be declare it and call into echo. Can i?

 

thanxs

Ok, then you can use require or include

 

Thanxs again Lumio for ur reply ll of replies from friends here. I really sorry if this question make hard for you to answer. Well i will try all of the best with this posting. Ok now i tell a 100% real case scenario. What i would like to do now is a develop a song request script to work out with Shoutcast service.

 

I already do a request form base script name file as request.php. Here is my code:

 

<?php
include ("config.php");

$reg = "yes";
$ip = $_SERVER['REMOTE_ADDR'];
?>
<html>
<head>
<title>Request a song</title>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
if (empty($_POST['song'])) {
echo "Sorry, you haven't supplied the song title!<br />";
$reg = "no";
}
if (empty($_POST['artist'])) {
echo "Sorry, you haven't supplied the artists name!<br />";
$reg = "no";
}
if (empty($_POST['name'])) {
echo "Sorry, you haven't supplied your name<br />";
$reg = "no";
}

  $sql = "SELECT COUNT(*) FROM request_song WHERE ip='{$ip}'";
  $result = mysql_query($sql);
  if (mysql_result($result, 0) > 0) {
echo "Sorry, your ip has already wished for one song, you can not wish for <br />another until the DJ's have seen your request!<br />";
$reg = "no";
}
if ($reg == "yes") {
    $sql = "INSERT INTO request_song(song, artist, name, ip)
            VALUES('{$_POST['song']}', '{$_POST['artist']}', '{$_POST['name']}', '{$ip}')";
    mysql_query($sql);
}
echo "Your ip is: ".$ip."<br />";
}
?>
<form action="request.php" method="POST">
<table>
<tr><td>Song title: </td><td><input type="text" name="song" value=""></td></tr>
<tr><td>Artist: </td><td><input type="text" name="artist" value=""></td></tr>
<tr><td>Your name: </td><td><input type="text" name="name" value=""></td></tr>
</table>
<input type="submit" name="submit" value="Send!">
</form>
</body>
</html> 

 

However that web page also i need to view a Shoutcast radio statistic so here is full Shoutcast radio statistic:

 

<?php
include ("config.php");

if ($scsuccs!=1) {
if($streamstatus == "1"){
if (isset($dj)) {
echo "
<b>Listeners:</b> $currentlisteners &nbsp<br>
<b>Current Stream URL</b>: <a href=\"http://$scip:$scport/listen.pls\"> http://$scip:$scport/listen.pls  </a><br>
<b>Current Stream Title</b>: $servertitle<br>
<b>Current Song:</b> $song[0]<br>
<b>Current DJ</b>: $name<br>
<b>Current DJ ID</b>: $dj<br>
";

if ((empty($aimdb)) && (isset($aim) && $aim) && ($aim != "N/A")) {
$aimdb = $aim;
}

if ((empty($icqdb)) && (isset($icq) && $icq)) {
$icqdb = $icq;
}

if (isset($aimdb) && $aimdb) {
echo "<b>AIM</b>: $aimdb<br>";
}

if (isset($msn) && $msn) {
echo "<b>MSN</b>: $msn<br>";
}

if (isset($yim) && $yim) {
echo "<b>YIM</b>: $yim<br>";
}

if (isset($icqdb) && $icqdb) {
echo "<b>ICQ</b>: $icqdb<br>";
}
if ($showsetby == 1) {
echo "<br><br><b>This DJ was found by checking:</b> $setby";
}

} else {
echo "<center><b>A DJ of LepakFM.net is not currently signed on to the system or not in duty today. LepakFM.net radio services may running on auto run mode. <br>Please check again later.</b></center><br>
<br><b>Current Stream Title</b>: $servertitle<br>
<b>Current Song:</b> $song[0]<br>";
}
} else {
echo "<b>A DJ of LepakFM.net is not currently connected to the radio or not in duty today. Please check again later.</b>";
}
} else {
echo "<b>Lepakfm.net radio services is currently down. Please check again later.</b>";
}
echo "<br><br><font size=\"-1\"><strong>Powered by $version - ©2007 sTup|D - <a href=\"http://www.lepakfm.net\" target=\"_blank\">www.lepakfm.net</a></strong></font>";
?>

 

So my problem is how to "insert request.php" into this echo:

 

<?php
include ("config.php");

if ($scsuccs!=1) {
if($streamstatus == "1"){
if (isset($dj)) {
echo "
<!-- I WANT TO PUT REQUEST SCRIPT HERE ---->
<br>
<b>Listeners:</b> $currentlisteners &nbsp<br>
<b>Current Stream URL</b>: <a href=\"http://$scip:$scport/listen.pls\"> http://$scip:$scport/listen.pls  </a><br>
<b>Current Stream Title</b>: $servertitle<br>
<b>Current Song:</b> $song[0]<br>
<b>Current DJ</b>: $name<br>
<b>Current DJ ID</b>: $dj<br>
";
[/quote]

So may i know how i can do that by put request script inside that echo? Thanxs

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.