- Impact
- 0
<form action="search1.php">
<input type="text" name="search">
<input type="submit" value="Search">
</form>
<?php
function main( $pic, $name, $type, $file, $description )
{
print "<img src=$pic><br><b>Name:</b> $name<br><b>Type:</b> $type<br><b>File-size:</b> ";
$findsize = filesize( "$file" );
$kbsize = $findsize / 128;
print "$kbsize KB<br><b>Added on:</b> ".date( "d M Y", filectime( $file ) )."<br><b>Description:</b> $description<p>";
}
if(!$search)
{
print "You didn't enter keywords to search for!<br>";
}
elseif ( $search == "something" or "something_else" )
{
main("Void.jpg", "Thing", "Logo", "Void.jpg", "Cool");
}
elseif ( $search == "another_thing" or "something" )
{
print "Another sentence<br>";
}
else
{
print "<b>$search</b> was not found on the server.<br>";
}
print "<br>Search tips | Click here for all files | Search the internet"
?>
theres my code.
Heres what i want to do:
1. User searches for something
2. If the $search variable is empty it says they didnt search for anything
3. If $search contains something, return all "elseif" statements that contain what the user searched for. (which, i know, is impossible..help please?)
4. If what the user searched for was not found say $search wasnt found
I know this code is full of mistakes, but im new to php so any help would be greatly appreciated!
Thanks in advance
<input type="text" name="search">
<input type="submit" value="Search">
</form>
<?php
function main( $pic, $name, $type, $file, $description )
{
print "<img src=$pic><br><b>Name:</b> $name<br><b>Type:</b> $type<br><b>File-size:</b> ";
$findsize = filesize( "$file" );
$kbsize = $findsize / 128;
print "$kbsize KB<br><b>Added on:</b> ".date( "d M Y", filectime( $file ) )."<br><b>Description:</b> $description<p>";
}
if(!$search)
{
print "You didn't enter keywords to search for!<br>";
}
elseif ( $search == "something" or "something_else" )
{
main("Void.jpg", "Thing", "Logo", "Void.jpg", "Cool");
}
elseif ( $search == "another_thing" or "something" )
{
print "Another sentence<br>";
}
else
{
print "<b>$search</b> was not found on the server.<br>";
}
print "<br>Search tips | Click here for all files | Search the internet"
?>
theres my code.
Heres what i want to do:
1. User searches for something
2. If the $search variable is empty it says they didnt search for anything
3. If $search contains something, return all "elseif" statements that contain what the user searched for. (which, i know, is impossible..help please?)
4. If what the user searched for was not found say $search wasnt found
I know this code is full of mistakes, but im new to php so any help would be greatly appreciated!
Thanks in advance












