below in the form action, i've put "test.php?w=$sw&h=$sh" but when i input the form and submit i get this..

test.php?search=example&submit=search

how do i get all together in the url? like this

http://test.php?w=$sw&h=$sh&search=example&submit=search

i even tried this

<form action="<?php 

$sw = $_GET['w'];
	 $sh = $_GET['h'];

$theurl = "http://test.php?w=$sw&h=$sh&";

echo $theurl; ?>" method="get">
       
          
            <input type="text" size="35" name="search" />  
            <input type="submit" name="submit" value="search" style="font-size:10px" />
      </form>

still comes up like "test.php?search=example&submit=search"

any help?

i'll simplify it later

Recommended Answers

All 5 Replies

Try this:

<?php 
$sw = $_GET['w'];
$sh = $_GET['h'];
?>
<form action="http://test.php" method="get">
<input type=hidden name="sw" value="<?php echo $sw; ?>" />
<input type=hidden name="sh" value="<?php echo $sh; ?>" />
<input type="text" size="35" name="search" />  
<input type="submit" name="submit" value="search" style="font-size:10px" />
</form>

first of all you both are going about this all wrong also you are not giving enough information on what you want done and the information the man gave you above is wrong also i need more information to help you and anyone else on here that knows what they are doing will need more information to help also since you can not use a
http://test.php?w=$sw&h=$sh&search=e...&submit=search
as you are trying to here it is imposable because you did not include you url like
http://example.com/test.php? ect.
or you can use this instead of using the above you can use this
test.php? ect.
and this method is much simpler unless you are calling to another url and script i would go to some of the websites below for a better understanding of html and php since you seem too be using both methods wrong it takes some learning to get the hang of it so here's the urls

http://www.w3schools.com
http://www.developphp.com/
http://php.net/

there are more but these i found to be the best when i was learning but even knowing how much i learned i am still learning so for you just to know you can be the best in your field but still not know every thing so it good to listen and help people and still do research also if you want to write these scripts you'll need a good IDE like the ones ill list below in links

http://www.waterproof.fr/
http://notepad-plus.sourceforge.net/uk/site.htm
http://www.adobe.com/products/dreamweaver/?promoid=DJDSZ

there are more but these i found to be the best two i listed are pay for but one is Open source meaning free and the free one is Notepad++
so there you go can if you and help with more just gave us more information that we need to use to help you with

first of all you both are going about this all wrong also you are not giving enough information on what you want done and the information the man gave you above is wrong

Of course the information he started with was wrong. If it wasn't, it would work, and he wouldn't need help. Also, if you are paying attention to his questions, you would see that he is giving PLENTY of information. Just because you do not understand the question does not mean that others do not as well.

also i need more information to help you and anyone else on here that knows what they are doing will need more information to help also since you can not use a
http://test.php?w=$sw&h=$sh&search=e...&submit=search
as you are trying to here it is imposable because you did not include you url like
http://example.com/test.php? ect.
or you can use this instead of using the above you can use this
test.php? ect.
and this method is much simpler unless you are calling to another url and script i would go to some of the websites below for a better understanding of html and php since you seem too be using both methods wrong it takes some learning to get the hang of it so here's the urls

Dude, that's one sentence. One. If you code like you write, then it's understandable that you thought my code is wrong.

Also, out of curiosity, how do you know that my answer is wrong if you do not "have enough information" to answer his question?


there are more but these i found to be the best when i was learning but even knowing how much i learned i am still learning so for you just to know you can be the best in your field but still not know every thing so it good to listen and help people and still do research also if you want to write these scripts you'll need a good IDE like the ones ill list below in links

I think that he has an editor. :)

there are more but these i found to be the best two i listed are pay for but one is Open source meaning free and the free one is Notepad++
so there you go can if you and help with more just gave us more information that we need to use to help you with

He has all of the information that he needs to solve the problem. Unless, of course, you can propose better code, which I would greatly love to see.

Also, the shift key is the one directly over the Control buttons (on a Windows™ machine, that is.)

Also, the whole http part of the code is wrong. I forgot to snip it out. :)

<?php 
$sw = $_GET['w'];
$sh = $_GET['h'];
?>
<form action="test.php" method="get">
<input type=hidden name="sw" value="<?php echo $sw; ?>" />
<input type=hidden name="sh" value="<?php echo $sh; ?>" />
<input type="text" size="35" name="search" />  
<input type="submit" name="submit" value="search" style="font-size:10px" />
</form>

First of all Wraithmanilian i wasn't trying to upset you but now that i look back on this information there is a enough information but also if your going to help people try using proper syntax as follows to my fix's to your code below now about my grammar it has nothing to do with how i write code. And i do not know if this person has an IDE and i don't know if you know if this person has one also i was just trying to help him/her find or get a good one that i have found on the WWW. also i listed a couple good sites that can help this person with some of there syntax need i was not trying to be rude if it came out that way.

now for my fix's to the code is to the $_GET and by writing it the way you did you would get a undefined Notice if the w or h is undefined now by writing it this way you will not also i find it better to use print(); instead of echo(); and for the finish you do not need to name the submit button but you can if you need to. Now how is that!

<?php
$sw = !empty($_GET['w']) ? $_GET['w'] : '';
$sh = !empty($_GET['h']) ? $_GET['h'] : '';
?>
<form action="test.php" method="get">
<input type="hidden" name="sw" value="<?php print($sw); ?>" />
<input type="hidden" name="sh" value="<?php print($sh); ?>" />
<input type="text" size="35" name="search" />  
<input type="submit" value="search" style="font-size:10px" />
</form>

Now MDanz sorry for all of this i didn't mean to be an ass if it came out that way but maybe so and the site and IDE's I've listed in my previous post may help you if you have not used any of them but i hope you used w3schools.com and php.net before and you most likely have but if not take a look they may help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.