Page 1 of 1
SOLVED | just one quick question...
Posted: Thu Sep 15, 2005 11:28 pm
by gothica
======================
the question:
in using the header form, let's say:
header("Location: Home.php?text=5");
then at Home.php i have a textbox with a blank value. how do i make it read the "...?textbox=5" so that it will show a value of 5 instead?
======================
things i've tried:
i've tried doing this on the textbox but it doesn't work
<input type="text" name="text" value="".$text>
or
<input type="text" name="text" value="".$_GET["text"]>
or
<input type="text" name="text" value="<?php echo $_GET["text"]; ?>">
Posted: Thu Sep 15, 2005 11:29 pm
by s.dot
Code: Select all
<input type="text" name="whatever" value="<? echo $_GET['text']; ?>">
Posted: Thu Sep 15, 2005 11:37 pm
by gothica
i tried it but it only prints out the word "<? echo.." on the textbox.
Posted: Thu Sep 15, 2005 11:38 pm
by s.dot
are you sure the page is a PHP page? is the extention .html ?
The <? echo .. should be parsed before the HTML ever gets generated, so if you're running a PHP page on a PHP enabled webserver, then the echo should never be seen.
Posted: Thu Sep 15, 2005 11:46 pm
by gothica
yes its a php page. actually the whole program is in php.
here's part of the code (incase you wanna check it)
Code: Select all
<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;
//ive also tried
<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET['meTOTAL']; ?>">' ;
Posted: Fri Sep 16, 2005 12:04 am
by feyd
short tags are likely off use <?php instead
Posted: Fri Sep 16, 2005 12:08 am
by ryanlwh
are you doing this:
Code: Select all
echo '<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;
This certainly would not work because the whole line is a string, and the <? echo .. ?> part is treated as a string. Unless you exited php mode before this line then the <? echo .. ?> would be parsed correctly.
If you're going for echoing the whole thing, it should be
Code: Select all
echo '<input type="text" name="meTOTAL" size="3" value = "'.$_GET["meTOTAL"].'">';
//or
echo "input type=\"text\" name=\"meTOTAL\" size=\"3\" value=\"$_GET[meTOTAL]\">";
Posted: Fri Sep 16, 2005 12:43 am
by gothica
ryanlwh wrote:are you doing this:
Code: Select all
echo '<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;
This certainly would not work because the whole line is a string, and the <? echo .. ?> part is treated as a string. Unless you exited php mode before this line then the <? echo .. ?> would be parsed correctly.
If you're going for echoing the whole thing, it should be
Code: Select all
echo '<input type="text" name="meTOTAL" size="3" value = "'.$_GET["meTOTAL"].'">';
//or
echo "input type="text" name="meTOTAL" size="3" value="$_GET[meTOTAL]">";
that definitely worked! thanks a lot man and thanks to all those who replied!