SA-MP Forums Archive
Help with PHP. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with PHP. (/showthread.php?tid=273411)



Help with PHP. - BuLLeT[LTU] - 01.08.2011

Hello. I wanted to make Submit button and when press, it redirects to url (eg: hostname.com/users.php?name=submited text

But i don't know how to redirect to this link. I was trying a lot of ways but noone worked.

I do this on submit page:
PHP код:
<html><head>Single-button form</head>
<
body>
<
form action="mydomain/serveronline.php" method="post"Enter a number: <input type="text" name="number" size="3"> <br>
<
input type="submit" name="submit"> </form>
</
body>
</
html
Then on mydomain/serveronline.php:
PHP код:
<?php
if ($_POST['submit'])
{
    
header('Location: http://www.mydomain.com/blog.php?name=. $_POST['number']');
}
?>
But i get this:
Parse error: syntax error, unexpected T_STRING in /home/mindauga/domains/mydomain.com/public_html/serveronline.php on line 4


Re: Help with PHP. - Scottas - 01.08.2011

1. It's not php support site.
2. Try this:
Код:
header('Location: http://www.mydomain.com/blog.php?name='.$_POST['number']);



Re: Help with PHP. - BuLLeT[LTU] - 01.08.2011

Warning: Cannot modify header information - headers already sent by (output started at /home/mindauga/domains/mydomain.com/public_html/serveronline.php:1) in /home/mindauga/domains/mydomain.com/public_html/serveronline.php on line 4


Re: Help with PHP. - Kingunit - 01.08.2011

Where you placed that code. You can't just drop the header code in the middle of your code.


Re: Help with PHP. - BuLLeT[LTU] - 01.08.2011

PHP код:
<?php
if ($_POST['submit'])
{
    
header('Location: http://www.mydomain.com/blog.php?name='.$_POST['number']);
}
?>
This all what i have on serveronline.php


Re: Help with PHP. - BuLLeT[LTU] - 01.08.2011

Finally i have done this...

PHP код:
<?php
if ($_POST['submit'])
{
$text1 $_POST['number'];
echo 
$text1;
$text2 "<script language='javascript'>window.location.href='/blog.php?name=$text1'</script>";
echo 
$text2;
}
?>