Jump to content

statement not working (again)


ukweb
 Share

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
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 7 years later...
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.