Jump to content


Photo

I have a line of php that isnt correct


  • Please log in to reply
4 replies to this topic

#1 bobleny

bobleny
  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 13 April 2006 - 02:28 AM

if (strpos($_POST['email'],"@") && strpos($_POST['email'],".") && strpos($_POST['email'] != " ") && $_POST['name'] != "" && $_POST['link1'] != "" || $_POST['link2'] != "" || $_POST['link3'] != "" || $_POST['link4'] != "" || $_POST['link5'] != "")

Yeah see that? somethings wrong with it! I think it has something to do with the perenthasies but i cant figure it out. I'm not to good with php. If any one can help please do!

Thanks
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 13 April 2006 - 03:23 AM

What are you trying to do?

This segment:
<?php strpos($_POST['email'] != " ") ?>
is missing some parameters.

Ken

#3 bobleny

bobleny
  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 13 April 2006 - 10:49 AM

Well i figuered it was that one because when you take it out it works. This is a if statement thats saying if all feileds check out the display send button. Evrey thing else works fine. I just tryed to add that so if the email feild has a space, it wont display the send button.

So? <?php strpos($_POST['email'] != " ") ?>
is missing some parameters.

what is it missing? it looks good to me...
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 13 April 2006 - 01:23 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]So? <?php strpos($_POST['email'] != " ") ?>
is missing some parameters.

what is it missing? it looks good to me...[/quote]

Did you look in the [a href=\"http://www.php.net/strpos\" target=\"_blank\"]manual[/a] to determine how to use the strpos() function?

Here is the desciptions:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]int strpos ( string haystack, mixed needle [, int offset] )

Returns the numeric position of the first occurrence of needle in the haystack string.[/quote]
You will notice that it needs at least two parameters. You gave it one, plus you have the closing parenthesis in the wrong place. You coded all the other calls to the function correctly,

Ken

#5 bobleny

bobleny
  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 13 April 2006 - 07:54 PM

Yeah, I, I.. I don't get the whole needle in the hey stack thing... naope
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users