how to check for part of a string<

liunx

Guest
okay I have a lil bit of code that i have been working on,
its for a friend of mine basically he needs to check if
http:// is part of a string
I tried using strpos to no avail any way here is the code


error_reporting(E_ALL^E_NOTICE):

$name = $_POST['value1'];
$link = $_POST['value2'];
$pos = strpos($name, $value);

if ($pos === false); {
echo "message here";
}

else {

if (isset($link) && $link) {

fp = fopen ("page.html" , "a+");
fwrite ($fp , "<a href=http://www.htmlforums.com/archive/index.php/\"$name\" target=\"_blank\">$link</a><br />\r\n");
fclose ($fp)

echo "thank you message";
}
else {
echo "error message";
}


the error i get is

parse error: parse error, unexpected T_ELSE in c:\easyphp\www\afil\affiliate.php on line 13



thanks in advance for your helpanyone out there know????you got a code error in your IF statement


if ($pos === false); {
echo "message here";
}


and please be patient - i know that we are superpowerful gurus, but we have day jobs too :Psorry bout being impatien HK :) thanks for that I never would have seen it

also i found another error i didn't close of my if statement but after all that it works perfectly... my code if any one wants to use it is


<?php
error_reporting(E_ALL^E_NOTICE);

$value = ('http://');
$name = $_POST['website'];
$link = $_POST['web_name'];
$pos = strpos($name, $value);

if ($pos === false) {
echo "include <!-- m --><a class="postlink" href="http://">http://</a><!-- m -->";
}

else {

if (isset($link) && $link) {

$fp = fopen ("affiliates.html" , "a+");
fwrite ($fp , "<a href=http://www.htmlforums.com/archive/index.php/\"$name\" target=\"_blank\">$link</a><br />\r\n");
fclose ($fp);


echo "thank you message";
}
else {
echo "broke it";
}
}
?>


Thanks againno worries - sometimes it just takes a fresh pair of eyes... go away, get a coffee and then have another go - usually works for me.I am surprised this worked

$value = ('http://');

it should be

$value = "http://";I am surprised this worked

$value = ('http://');

it should be

$value = "http://";


I was not aware that this was a problem but i will fix it, I just played with it by doing this


$value = =('http://');

echo "$value";


and it worked so I used it like that, thanks for the info scoutt, I still have a way to go but am getting there
 
Back
Top