Jump to content

Recommended Posts

Hi Guys ...

 

can you please tell me what i am doing wrong here

<?php

$ShowBookmark = "False";
include 'Include/Header.php';

 if (Get_QString('Post') == "True") {
	  GetGuide();
} else {
                  Show_Form();

}


function Show_Form() {
      $thedate = date('l dS F Y');
      echo '<div class="hd2"><font color=#666666><strong><center>Tv Guide</center></strong></font></div>';
      echo '<br><center><font face="Verdana" size="2" color="blue"><u>' .$thedate. '</center></u></font>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc1">Sabc 1</font></a>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc2">Sabc 2</font></a>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc3">Sabc 3</font></a>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=Mnet">Mnet</font></a>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=ETV">Etv</font></a>';

}


function GetGuide() { 
     if($_GET['channel'] == "sabc1"){ 
     $getMyDataFrom = $Table[1];
}
    if($_GET['channel'] == "sabc2"){ 
    $getMyDataFrom = $Table[2];
}
    if($_GET['channel'] == "sab3"){ 
    $getMyDataFrom = $Table[3];
}

    if($_GET['channel'] == "Mnet"){ 
    $getMyDataFrom = $Table[4];
}
    if($_GET['channel'] == "ETV"){ 
    $getMyDataFrom = $Table[5];
}

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/
Share on other sites

I'd say the first thing you got wrong was neglecting to specify what your problem is, and assuming we'd somehow know (via telepathy?  ESP?  tarot cards?) without any context.

 

The second is not giving more code.  What is Get_QString()?  Where are you defining your $Table array?  Again, context.  What are you trying to do, and how is it not working?  Be specific.

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966562
Share on other sites

ok this is a tv guide and pulls the data from my 1 site to the other now when u go to Tvguide.php it gives u a menu of 5 channels and when you pick a channel it then goes down and gives the channel each channel has a table expl sabc 1 table[1] sabc 2 table[2]

now i just cant seem to get this rite here is the full code and sorry for my silly first post

<?php


$ShowBookmark = "False";
include 'Include/Header.php';

 if (Get_QString('Post') == "True") {
	  GetGuide();
} else {
                  Show_Form();

}


function Show_Form() {
$thedate = date('l dS F Y');
echo '<div class="hd2"><font color=#666666><strong><center>Tv Guide</center></strong></font></div><br>';
  echo '<br><center><font face="Verdana" size="2" color="blue"><u>' .$thedate. '</center></u></font><br>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc1">Sabc 1</font></a><br>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc2">Sabc 2</font></a><br>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=sabc3">Sabc 3</font></a><br>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=Mnet">Mnet</font></a><br>';
      echo '<font face="Verdana" color="red" size="2"><a href="Tvguide.php?channel=ETV">Etv</font></a><br>';

}


function GetGuide() { 
     if($_GET['channel'] == "sabc1"){ 
     $getMyDataFrom = $Table[1];
}
    if($_GET['channel'] == "sabc2"){ 
    $getMyDataFrom = $Table[2];
}
    if($_GET['channel'] == "sab3"){ 
    $getMyDataFrom = $Table[3];
}

    if($_GET['channel'] == "Mnet"){ 
    $getMyDataFrom = $Table[4];
}
    if($_GET['channel'] == "ETV"){ 
    $getMyDataFrom = $Table[5];
}
$url = "http://mysite.com";
$RawData = @file_get_contents($url) or die('Could not access file: $url');
$Table = ExData($RawData,'<div style="font-size:12px; padding-top:15px; padding-left:9px">',"</div>");
$FGuide = $getMyDataFrom;

$i=2; 
$upper = 60;

while ($i <= $upper) {
    $FGuide = str_replace($i, '<font face="Verdana" color="red" size="2">' . $i . '</font>', $FGuide);
    $i++;
}
    $FGuide = str_replace('0', '<font face="Verdana" color="red" size="2">0</font>', $FGuide);
  $FGuide = str_replace(1, '<font face="Verdana" color="red" size="2">1</font>', $FGuide);
  $FGuide = str_replace(':', '<font face="Verdana" color="green" size="2">:</font>', $FGuide);

return $FGuide;

}

function ExData($text, $openingMarker, $closingMarker) {    
  $openingMarkerLength = strlen($openingMarker);    
  $closingMarkerLength = strlen($closingMarker);     
  $result = array();    
  $position = 0;    
  while (($position = strpos($text, $openingMarker, $position)) !== false) {      
     $position += $openingMarkerLength;      
     if (($closingMarkerPosition = strpos($text, $closingMarker, $position)) !== false) {       
        $result[] = substr($text, $position, $closingMarkerPosition - $position);        
        $position = $closingMarkerPosition + $closingMarkerLength;      
     }    
  }  
  return $result;  
}
?>
<div class="hd2"><center><font color=#666666><strong><img src="Images/tvguide/sabc1.jpg"></strong></font></center></div><br>
	<? 
  // Prints the date
$thedate = date('l dS F Y');
  echo '<center><font face="Verdana" size="2" color="blue"><u>' .$thedate. '</center></u></font>';
?>
<br><font face="Verdana" size="2"><?php echo GetGuide(); ?></font><br>
<center><font face="Verdana" size="2"><?php echo $GLOBALS["Advert03"]; ?></font></center>
<table id="" border="0" style="font-size:9pt;width:100%;">
	<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>
		<font face="Verdana" size="2"><b><a href="TvGuide.php">Back</b></font></a><br>
	</td></tr>
</table>
<hr>

<?php include 'Include/Footer.php'; Log_Hit("TvGuide"); ?>

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966565
Share on other sites

apology accepted for the second silly post, as well.

 

i find Tarot cards only work 95% of the time when diagnosing a problem, but they're not sending out any messages on this one.

 

you need to specify what is going on.  all you've said so far is what the code does, and, "now i just cant seem to get this rite".

 

so, if i was to give you this as my question:

 

ok this is a tv guide and pulls the data from my 1 site to the other now when u go to Tvguide.php it gives u a menu of 5 channels and when you pick a channel it then goes down and gives the channel each channel has a table expl sabc 1 table[1] sabc 2 table[2]

 

what do you think someone can do with that in terms of really, really helping you in a timely fashion?

 

i don't mean to rant, but i really enjoy helping people to the best of my abilities, but it just seems that the past while, i spend more time trying to interpret people's problems than actually helping to solve them.

 

common sense, people.  imagine the people on this board are a bunch of doctors.  ask for a diagnosis for your script as you would a doctor for an ailment.

 

 

now, please explain the issue you're having, any error codes that are present, what the code is supposed to be doing as apposed to what the code is actually doing, and so on.

 

let's make this fun again.

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966584
Share on other sites

ok firstly sorry again lol now the first error i get is the page shows both the form and the get guide here is a demo http://bhawap.com/Tvguide.php and because i used 

  if($_GET['channel'] == "sabc1"){ 
            GetGuide(); 

if i pick say sabc 2 it goes rite back to the main menu how do i fix this

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966587
Share on other sites

ok firstly sorry again lol now the first error i get is the page shows both the form and the get guide here is a demo http://bhawap.com/Tvguide.php and because i used 

  if($_GET['channel'] == "sabc1"){ 
            GetGuide(); 

if i pick say sabc 2 it goes rite back to the main menu how do i fix this

 

??

 

The code you originally gave was:

 

if(Get_QString('Post') == true)
{
   GetGuide();
}

 

You check $_GET within GetGuide().

 

Here's a suggestion: organize your code.  Right now you're mixing function definitions with actual executing code, which makes it a mess to read, and is probably part of your problem.  Also, again, you need to show what Get_QString() is, as it's not in either of the code blocks you've given.

 

I'm getting the feeling that you're over-thinking your problem, and thus over-engineering your solution.  Start with channel 1.  Once that works, move on to getting channel 2 to work.  Don't try for it all at once.

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966590
Share on other sites

the first code was not working at all so i changed it and now it does work, i just have 3 errors

1: how do i set a var so i can show an image 

2: how do i stop the page from showing the form and the guide together

3: how do i set the start if statment to work rite this is my code i have now and sabc 1 works 100% if i click but no others will work

 

for the first 1 i tought maybe i could use this

 to set the var $logo = <img src="Images/tvguide/sabc1.jpg">;  //and to display it echo '<div class="hd2"><center><font color=#666666><strong>' .$logo. '</strong></font></center></div><br>';

but it never anyways here is my code u can view a demo on www.bhawap.com/Tvguide.php

<?php


$ShowBookmark = "False";
include 'Include/Header.php';

if($_GET['channel'] != "sabc1") {          
           Show_Form(); 
       }else {
                GetGuide(); 	
} 

function Show_Form() {
      $thedate = date('l dS F Y');
      echo '<div class="hd2"><font color=#666666><strong><center>Tv Guide</center></strong></font></div><br>';
      echo '<table id="" border="0" style="font-size:9pt;width:100%;">';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/tvguide/sabc1-icon.gif"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="Tvguide.php?channel=sabc1">Sabc 1</b></font></a><br>';
      echo '</td></tr>';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/tvguide/sabc2-icon.gif"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="Tvguide.php?channel=sabc2">Sabc 2</b></font></a><br>';		
      echo '</td></tr>';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/tvguide/sabc3-icon.gif"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="Tvguide.php?channel=sabc3">Sabc 3</b></font></a><br>';
      echo '</td></tr>';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/tvguide/etv-icon.jpg"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="Tvguide.php?channel=ETV">Etv</b></font></a><br>';		
      echo '</td></tr>';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/tvguide/mnet-icon.jpg"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="Tvguide.php?channel=Mnet">Mnet</b></font></a><br><br>';			
      echo '</td></tr>';
      echo '</table>';
      echo '<center><font face="Verdana" size="2"><?php echo $GLOBALS["Advert03"]; ?></font></center>';
      echo '<table id="" border="0" style="font-size:9pt;width:100%;">';
      echo '<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>';
      echo '<font face="Verdana" size="2"><b><a href="index.php">Back</b></font></a><br>';
      echo '</td></tr>';
      echo '</table>';
      echo '<hr>';

include 'Include/Footer.php';
}
  

function GetGuide() { 
     if($_GET['channel'] == "sabc1"){ 
     $getMyDataFrom = $Table[1];
}
    if($_GET['channel'] == "sabc2"){ 
    $getMyDataFrom = $Table[2];
}
    if($_GET['channel'] == "sab3"){ 
    $getMyDataFrom = $Table[3];
}

    if($_GET['channel'] == "Mnet"){ 
    $getMyDataFrom = $Table[4]; 
}
    if($_GET['channel'] == "ETV"){ 
    $getMyDataFrom = $Table[5];
}
$url = "http://mysite.php";
$RawData = @file_get_contents($url) or die('Could not access file: $url');
$Table = ExData($RawData,'<div style="font-size:12px; padding-top:15px; padding-left:9px">',"</div>");
$FGuide = $getMyDataFrom;

$i=2; 
$upper = 60;

while ($i <= $upper) {
    $FGuide = str_replace($i, '<font face="Verdana" color="red" size="2">' . $i . '</font>', $FGuide);
    $i++;
}
    $FGuide = str_replace('0', '<font face="Verdana" color="red" size="2">0</font>', $FGuide);
  $FGuide = str_replace(1, '<font face="Verdana" color="red" size="2">1</font>', $FGuide);
  $FGuide = str_replace(':', '<font face="Verdana" color="green" size="2">:</font>', $FGuide);

return $FGuide;

}

function ExData($text, $openingMarker, $closingMarker) {    
  $openingMarkerLength = strlen($openingMarker);    
  $closingMarkerLength = strlen($closingMarker);     
  $result = array();    
  $position = 0;    
  while (($position = strpos($text, $openingMarker, $position)) !== false) {      
     $position += $openingMarkerLength;      
     if (($closingMarkerPosition = strpos($text, $closingMarker, $position)) !== false) {       
        $result[] = substr($text, $position, $closingMarkerPosition - $position);        
        $position = $closingMarkerPosition + $closingMarkerLength;      
     }    
  }  
  return $result;  
}
echo '<div class="hd2"><center><font color=#666666><strong>' .$logo. '</strong></font></center></div><br>';	
  // Prints the date
$thedate = date('l dS F Y');
  echo '<center><font face="Verdana" size="2" color="blue"><u>' .$thedate. '</center></u></font>';
?>
<br><font face="Verdana" size="2"><?php echo GetGuide(); ?></font><br>
<center><font face="Verdana" size="2"><?php echo $GLOBALS["Advert03"]; ?></font></center>
<table id="" border="0" style="font-size:9pt;width:100%;">
	<tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>
		<font face="Verdana" size="2"><b><a href="Tvguide.php">Back</b></font></a><br>
	</td></tr>
</table>
<hr>

<?php include 'Include/Footer.php'; Log_Hit("TvGuide"); ?>

Link to comment
https://forums.phpfreaks.com/topic/183144-get-problem/#findComment-966615
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.