Page 2 of 3
Re: Registration Problem really need help
Posted: Mon Aug 04, 2008 8:51 pm
by Stryks
Ravx, help us to help you.
Firstly, when posting sections of code, use the code tags. If you click the code button above the reply text box, it will insert the basic tags for you. You can then add =php in the code tags, and then you just put your code inside. eg.
[ code=php ]your code goes here[ /code ]
(without spaces in the tags of course)
Also, when you post, or reply to further one of your own posts, try to give as much detail about what is happening as possible. Comments like 'That didn't work', 'I get an error', or 'I tried X but no luck' are entirely unhelpful. How did it fail? Did you get any error messages? What were they *exactly*? Was there any unexpected output at all? What was it?
As for echoing the $_GET variable, it's exactly the same format as the $_POST.
But don't add that inside the switch statement, add it on the line before. That will probably mean you wont need the <?php ?> tags around it assuming that you are already in a php block.
As for how you are echoing that $_POST value ... what IS it outputting into the newusername field?
Cheers
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 6:10 am
by ravx
Stryks wrote:Ravx, help us to help you.
Firstly, when posting sections of code, use the code tags. If you click the code button above the reply text box, it will insert the basic tags for you. You can then add =php in the code tags, and then you just put your code inside. eg.
[ code=php ]your code goes here[ /code ]
(without spaces in the tags of course)
Also, when you post, or reply to further one of your own posts, try to give as much detail about what is happening as possible. Comments like 'That didn't work', 'I get an error', or 'I tried X but no luck' are entirely unhelpful. How did it fail? Did you get any error messages? What were they *exactly*? Was there any unexpected output at all? What was it?
As for echoing the $_GET variable, it's exactly the same format as the $_POST.
But don't add that inside the switch statement, add it on the line before. That will probably mean you wont need the <?php ?> tags around it assuming that you are already in a php block.
As for how you are echoing that $_POST value ... what IS it outputting into the newusername field?
Cheers
Hi well basically i have the registration form made in the table, and when i click thesubmit button it the page simply reloads,
Code: Select all
html code -<input type="text" id="newusername" name="newusername" value="<?php echo $_POST['newusername']; ?>">
Code: Select all
the php code -switch($_GET['action']) {
case "vaildation":
if (!empty($_POST['newusername']))
{
header('location:www.google.co.uk');
}
}
So this should redirect to google when not blank but when the button is clicked it simply reload the page and i dont understand whats wrong, but im trying to work on it.
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 7:08 am
by Stryks
Replace the code you have quoted above with the following.
Code: Select all
switch($_GET['action']) {
case 'vaildation':
if (!empty($_POST['newusername']))
{
header('Location: http://www.google.co.uk');
exit();
}
default:
if(isset($_POST['newusername'])) echo "newusername is set to {$_POST['newusername']}"; else echo "newusername is not set";
}
Are you aware that you spelled validation incorrectly?
Anyhow, try that and let me know what happens.
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 11:00 am
by ravx
Stryks wrote:Replace the code you have quoted above with the following.
Code: Select all
switch($_GET['action']) {
case 'vaildation':
if (!empty($_POST['newusername']))
{
header('Location: http://www.google.co.uk');
exit();
}
default:
if(isset($_POST['newusername'])) echo "newusername is set to {$_POST['newusername']}"; else echo "newusername is not set";
}
Are you aware that you spelled validation incorrectly?
Anyhow, try that and let me know what happens.
Hi yh i did notice that and i was using a program with excellent debug feature and will execute
line by line and i found that the switch and if statement does execute the header('Location:
http://www.google.co.uk'); is casuing the problem, the error message is:
cannot modify header information, header already sent by registration.php line 4;
but anyways I know that it works now and will try to have everything fixed and fully working
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 12:40 pm
by jaoudestudios
You should have all errors displaying during testing, as it helps solve issues.
Headers can not be resent! Even if a space is sent to the browser then the headers can not be resent.
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 3:04 pm
by ravx
jaoudestudios wrote:You should have all errors displaying during testing, as it helps solve issues.
Headers can not be resent! Even if a space is sent to the browser then the headers can not be resent.
Hi the issues have been solved but can help me on this on please
basically, I have a function that vaildates the email:
Code: Select all
function validationofemail($email)
{
global $resultemail;
$resultemail = true;
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
$resultemail = FALSE;
}
return $resultemail;
}
and than a if statement outside the fuction that takes the returned variable and runs some code according to it being false or true but due the scope of teh variable the variablke in the if statement if null how can I do this the right way.
Code: Select all
if (!$resultmail)
{
$error ='Please ensure that your email is vaild and does not contain special characters';
exit();
} else {
$readytopostemail = mysql_real_escape_string($_POST['email']);
}
Thanks
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 3:06 pm
by ravx
Hi I problems with the registration template I declared a variable $error
Code: Select all
<td><strong><?php echo "<font face=verdana color=red>$error</red>"; ?></strong></td>
and in the php processing using the if statement when I write $error = 'Error in processing your application'; the text does not appear.
Code: Select all
else {
$error ="<font face=verdana size=2 color=red>An error has occured while trying to register please try again and ensure that all the fields are entered</font>";
I have also tried without the font statement.
Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 4:22 pm
by jaoudestudios
Is that html 3???

Re: Registration Problem really need help
Posted: Tue Aug 05, 2008 4:23 pm
by ravx
jaoudestudios wrote:Is that html 3???

I checked the html of teh rendered page and the variable value dont print:
this is was you get
Code: Select all
<td><strong><font face=verdana color=red></red></strong></td>
well the file format is php but im not sure how do i check i think it xhtml.
Re: Registration Problem really need help
Posted: Wed Aug 06, 2008 1:48 am
by jaoudestudios
It is definitely not xhtml. You would use CSS for styling in xhtml, not strong, font..etc..
Check $error is not empty.
Try this...
Re: Registration Problem really need help
Posted: Wed Aug 06, 2008 4:08 am
by ravx
jaoudestudios wrote:It is definitely not xhtml. You would use CSS for styling in xhtml, not strong, font..etc..
Check $error is not empty.
Try this...
When run the code line by line the $error does have the message but for somereason it don't display in the html after, when checking the html there isnt the text in the part of the code where the $error was.
Re: Registration Problem really need help
Posted: Wed Aug 06, 2008 4:19 am
by Stryks
Among other issues, the code you posted only shows $error being set right before an exit() call, which means it never gets used.
What tool are you using to debug this line by line to know that it is set though it outputs nothing?
A full post of your code might help us see where you're going wrong.
Re: Registration Problem really need help
Posted: Wed Aug 06, 2008 3:54 pm
by ravx
Stryks wrote:Among other issues, the code you posted only shows $error being set right before an exit() call, which means it never gets used.
What tool are you using to debug this line by line to know that it is set though it outputs nothing?
A full post of your code might help us see where you're going wrong.
Hi, ok on the html I have the code
Code: Select all
<td><font face=verdana color=red><?php $error?></red></td>
and in the php i have this vaildation amoung others
Code: Select all
if (!$resultemail)
{
$error = 'Please ensure that your email is vaild and does not contain special characters(Code:1001)';
exit();
} else {
$readytopostemail = mysql_real_escape_string($_POST['email']);
}
The exit(); is after the $error is set so it should work right.
Re: Registration Problem really need help
Posted: Wed Aug 06, 2008 6:12 pm
by Stryks
Well .... should it really?
Set up a new page and insert this ...
Code: Select all
<?php
$error = "whassup?";
exit();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Page</title>
</head>
<body>
Hello ... this is a test.
<?php echo $error; ?>
</body>
</html>
What do you think should happen? Try it ... does it do what you expected?
Also, you need to post bigger sections of code ... or at least give some indication of the relationship of the snippets. Are those in the same file or are they seperate, and if so, how are they called? Without this information it becomes more like a guessing game.
Anyhow, try that code and let us know what is going on.
Cheers.

Re: Registration Problem really need help
Posted: Thu Aug 07, 2008 5:08 am
by ravx
Stryks wrote:Well .... should it really?
Set up a new page and insert this ...
Code: Select all
<?php
$error = "whassup?";
exit();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Page</title>
</head>
<body>
Hello ... this is a test.
<?php echo $error; ?>
</body>
</html>
What do you think should happen? Try it ... does it do what you expected?
Also, you need to post bigger sections of code ... or at least give some indication of the relationship of the snippets. Are those in the same file or are they seperate, and if so, how are they called? Without this information it becomes more like a guessing game.
Anyhow, try that code and let us know what is going on.
Cheers.

Hi, The problem has been fixed, the issue was to do with the placement of the code, anyways thanks.