Jump to content


Photo

statement not working (again)


  • Please log in to reply
5 replies to this topic

#1 ukweb

ukweb
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts
  • LocationLlandudno, North Wales

Posted 07 June 2006 - 11:23 AM

Hi

In all my time developing php apps have i ever encountered so many problems as I have with this project. It has been some time since I last developed anything like this but it is really winding me up as i cannot see where the problems are.

The problem page is here:

[a href=\"http://www.servewales.co.uk/members/register.php\" target=\"_blank\"]http://www.servewales.co.uk/members/register.php[/a]

and it is not supposed to display "you did not specify your first name" unless there is a get variable called action which is set to confirm. Here is the code for this line of text:

<?php if ( $_POST['first_name']  == '' &&  $_GET['action'] == 'confirm'  ) { ?>
You did not specify your first name
<?php } 
if ( ! ($_POST['first_name'] == "") ) {
$v3 = "1";
}
 ?>

THe last bit of code just sets a value for $v3 which works fine.

HELP PLEASE!

#2 kenrbnsn

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

Posted 07 June 2006 - 11:44 AM

Have you put any debugging lines in your code so you can see what you are actually testing against?
<?php
echo '<pre> $_POST: ' . print_r($_POST,true) . '</pre>'; // debug
echo '<pre> $_GET: ' . print_r($_GET,true) . '</pre>';    // debug
 if ($_POST['first_name']  == '' &&  $_GET['action'] == 'confirm') 
    echo 'You did not specify your first name';
if ($_POST['first_name'] != '')
    $v3 = "1";
?>

Ken

#3 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 07 June 2006 - 01:00 PM

well at some point in time the 2 conditions of your if statement are being met, and therefore that message is displaying. but you need to post more code than that. there is no way to find the bug based on that.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#4 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 07 June 2006 - 01:04 PM

Post some of your code so we can help out.

you could try this

if ($_POST['first_name']  == '' &&  $_GET['action'] == 'confirm'){
    echo 'You did not specify your first name';
} else {
echo '&nbsp;';
}
if ($_POST['first_name'] != ''){
$v3 = "1";
}
use &nbsp; and not just a space because mose tables will not print a space so you need the code FOR a space to print.

Ray

#5 servewales

servewales
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 08 December 2013 - 11:26 PM

odd question but did ukweb own this domain in 2006 ???



#6 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 09 December 2013 - 12:41 AM

http://bit.ly/1buzMMy






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users