Jump to content

statement not working (again)


ukweb

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/11401-statement-not-working-again/
Share on other sites

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

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 ' ';
}
if ($_POST['first_name'] != ''){
$v3 = "1";
}

use   and not just a space because mose tables will not print a space so you need the code FOR a space to print.

 

Ray

  • 7 years later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.