dfwcomputer Posted December 23, 2006 Share Posted December 23, 2006 hi,i have a php page that is know working exactly the way i want it (thanks to thorpe...see link below).......but would like some help on formatting the result output......Does anyone know of a good tutorial on this...[url=http://www.phpfreaks.com/forums/index.php?topic=119590.0]http://www.phpfreaks.com/forums/index.php?topic=119590.0[/url]Thanks Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/ Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 All formatting is done via html not php. What do you want to do? Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146685 Share on other sites More sharing options...
dfwcomputer Posted December 23, 2006 Author Share Posted December 23, 2006 i would just like to change the output....i.e. what it looks like....also i added else else echo "<p>is not a cheater.</p>"; at the bottom so if nothing was found it displayed that...but it didn't work....[code]<?php function ischeater($search,$type) { switch ($type) { case 'GUID': $pos = 2; break; case 'UserName': $pos = 3; break; case 'IP Address': $pos = 4; break; case 'MAC': $pos = 5; break; } $files = array('aci.txt','aon.txt','aasa.txt');foreach ($files as $file) { $lines = file($file); foreach ($lines as $line) { $line = str_replace('"','',$line); $tmp = explode(' ',$line); if ($tmp[$pos] == $search) { return $line; } }} return false; } if (isset($_POST['Submit'])) { if ($line = ischeater($_POST['textfield'],$_POST['select'])) { echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> "; echo $line; else echo "<p>is not a cheater.</p>"; }}?>[/code]thanks Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146690 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 [code=php:0]if (isset($_POST['Submit'])) { if ($line = ischeater($_POST['textfield'],$_POST['select'])) { echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> "; echo $line; } else { echo "<p>is not a cheater.</p>"; }}[/code] Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146691 Share on other sites More sharing options...
dfwcomputer Posted December 23, 2006 Author Share Posted December 23, 2006 arrrh...that makes sense even to me........how do you change the output of how it is diplayed e.g.maybe have a bacground colour....Thanks Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146692 Share on other sites More sharing options...
dfwcomputer Posted December 23, 2006 Author Share Posted December 23, 2006 that came up with [quote]Parse error: parse error, unexpected T_ELSE in F:\www\test\index.php on line 35[/quote] Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146694 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 There is no parse error in my code, and as I said, formatting for dispaly has nothing to do with php, your question is that of html. We have a html help forum, but you really need to look at some tutorials. Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146697 Share on other sites More sharing options...
dfwcomputer Posted December 23, 2006 Author Share Posted December 23, 2006 thanks i'll do that.....can you double check what i have...but it seems right....[code]<?php function ischeater($search,$type) { switch ($type) { case 'GUID': $pos = 2; break; case 'UserName': $pos = 3; break; case 'IP Address': $pos = 4; break; case 'MAC': $pos = 5; break; } $files = array('aci.txt','aon.txt','aasa.txt');foreach ($files as $file) { $lines = file($file); foreach ($lines as $line) { $line = str_replace('"','',$line); $tmp = explode(' ',$line); if ($tmp[$pos] == $search) { return $line; } }} return false; } if (isset($_POST['Submit'])) { if ($line = ischeater($_POST['textfield'],$_POST['select'])) { echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> "; echo $line; } else { echo "is not a cheater."; }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146698 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 You need to keep proper indentation to make it easy to read / maintain.[code]<?php function ischeater($search,$type) { switch ($type) { case 'GUID': $pos = 2; break; case 'UserName': $pos = 3; break; case 'IP Address': $pos = 4; break; case 'MAC': $pos = 5; break; } $files = array('aci.txt','aon.txt','aasa.txt'); foreach ($files as $file) { $lines = file($file); foreach ($lines as $line) { $line = str_replace('"','',$line); $tmp = explode(' ',$line); if ($tmp[$pos] == $search) { return $line; } } } return false; } if (isset($_POST['Submit'])) { if ($line = ischeater($_POST['textfield'],$_POST['select'])) { echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> "; echo $line; } else { echo "is not a cheater."; } }?>[/code]but yeah... I dont see any errors. Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-146700 Share on other sites More sharing options...
dfwcomputer Posted December 27, 2006 Author Share Posted December 27, 2006 thankyou....sorry i've been away.....can anyone suggest a good tutorial..... Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-148197 Share on other sites More sharing options...
trq Posted December 27, 2006 Share Posted December 27, 2006 www.w3schools.com/html Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-148218 Share on other sites More sharing options...
dfwcomputer Posted December 28, 2006 Author Share Posted December 28, 2006 ok....great site by the way....but i want to learn to incorporate it into php....I'm quite good with html/xhtml but putting them together seems to be the trouble....e.g.[code]<?php function ischeater($search,$type) { switch ($type) { case 'GUID': $pos = 2; break; case 'User Name': $pos = 3; break; case 'IP Address': $pos = 4; break; case 'MAC': $pos = 4; break; } $files = array('aasa.txt','aci.txt','aon.txt');foreach ($files as $file) { $lines = file($file); foreach ($lines as $line) { $line = str_replace('"','',$line); $tmp = explode(' ',$line); if ($tmp[$pos] == $search) { return $line; } }} return false; } if (isset($_POST['Submit'])) { if ($line = ischeater($_POST['textfield'],$_POST['select'])) { echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> "; echo $line; } else { echo "is not a cheater."; }}?>[/code]you'll notice [code]echo $_POST['textfield']." is a cheater.<br /><h2>See Details Below</h2><br /> ";[/code]i got that to work and it know outputs like this;[img]http://farm1.static.flickr.com/138/335765674_2081f801a4_o.jpg[/img]I would like to add a background colour to the php page and maybe "Results" above [code]a54f64fe1563456cb67d8fc2aec04607 is a cheater.[/code]Thanks Link to comment https://forums.phpfreaks.com/topic/31647-displaying-php-results/#findComment-148583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.