Shoutbox

Transfering Php code? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Transfering Php code? (/showthread.php?tid=43674)

Transfering Php code? by Jhrono on 04-26-2005 at 02:28 PM

Like i'm doing this code...and i want to transfer users to the form when they don't answer all of the values...i did it like this..

code:
<?php>
$a = $_POST['field1'];
$b = $_POST['field2'];
(...)
elseif ($a == 0 && $b == 0) {
echo "Please insert at least one value in the form. You'll be transfered to it again in 5 seconds" };
<?>


What shall i insert in the last elseif to transfer users?

Another question?is there another way to make a value = to nothing?'cause i'm going to make the form default number 0 but people may delete the 0's and click Go, and that won't have a function in the php code:S...to realise what zeros i'm talking about i made them bold...




RE: Transfering Php code? by VLenin on 04-26-2005 at 02:32 PM

use isset() and !empty()

this code sucks, it only creates dirty shit


RE: Transfering Php code? by Jhrono on 04-26-2005 at 02:35 PM

quote:
Originally posted by VLenin


use isset() and !empty()



I'm noob at php so could you give me an example of those working?thanks..

quote:
Originally posted by VLenin

this code sucks, it only creates dirty shit


I hope you aren't talking about my code...You don't EVEN KNOW WHAT IT IS ABOUT...do you think the value name is a and b?and the form values are form 1 and 2?i erased 'cause i'm doing something new...
RE: Transfering Php code? by VLenin on 04-26-2005 at 02:53 PM

hey chill,

<?php>
$a = $_POST['field1'];
$b = $_POST['field2'];
(...)
elseif ($a = 0 && $b = 0) {
echo "Please insert at least one value in the form. You'll be transfered to it again in 5 seconds" };
<?>
is not nice...

ok

use it like this

if (isset($_POST['field1']) AND isset($_POST['field2']) AND !empty($_POST['field1']) AND !empty($_POST['field2']))
{
   echo "ok, form is ok, let's go on!";
}
else
{
  echo "Not all fields are ok, bla die bla";
}


RE: Transfering Php code? by Jhrono on 04-26-2005 at 03:04 PM

But what's the function that tells that one value is empty(like ($_POST['field']) = nothing :S)?i really need that to do some other aspects...


RE: Transfering Php code? by VLenin on 04-26-2005 at 03:10 PM

What do you mean with other aspects? empty only returns a boolean...


RE: Transfering Php code? by Jhrono on 04-26-2005 at 03:13 PM

Guess what?i don't care about your complications rofl...

I'll do it simply with the 0's...who deletes the 0's is an ass..

What i need to know is the transfering function...


RE: Transfering Php code? by fluffy_lobster on 04-26-2005 at 03:16 PM

Perhaps you mean $a == 0 not $a = 0.


RE: Transfering Php code? by Jhrono on 04-26-2005 at 03:23 PM

rofl sorry my mistake, but read what i said...if someone deletes the 0 and submits it with no value, i need a entity like 0 to change it...'cause no value is simply no value..


RE: Transfering Php code? by fluffy_lobster on 04-26-2005 at 03:25 PM

Well both 0, empty and null evaluate as false... so just do elseif(!$a && !$b)


RE: Transfering Php code? by Jhrono on 04-26-2005 at 03:31 PM

Thank you, YOU FLUFFY LOBSTER ;) :)...

anyways, can you tell me whats the transfering function? to transfer the user back to the form when he doesnt enter nothign?thanks


RE: Transfering Php code? by VLenin on 04-26-2005 at 03:40 PM

header ("Location: screwthenooplook@php.net");


RE: Transfering Php code? by segosa on 04-26-2005 at 05:21 PM

Indeed. When he told you empty() and isset() the first thing you do is look them up at php.net. If you don't understand what they say you read further down at the user-contributed comments. If you want to know how to program you need to be able to read documentation. If you're not willing to do that then you may as well give up.