If i have form where i have a value like this value="" so there is no value i need to get the "3435435" value from the url like below. http://www.somesite.com/blahblah&_moon=3435435 then add it into the FORM value so when the form submits its like this value="3435435" any ideas?
Not sure i follow but i think you want to grab the value form the address bar? no probs, you would use a $_GET like so: www.somesite.com/example_id=123&another_example_id=456 PHP: on the page just do: $id_1 = $_GET['example_id']; $id_2 = $_GET['another_example_id']; // testing we caught the ids // print("The example id: $id_1 and the another example id is: $id_2"); PHP: thats the basics of it, there more secure ways to do the above though, hope thats a help to you. Graham
In the actual code it would be: value="<?=$_GET['_moon'];?>" PHP: However, in that state it's vulnerable to Cross Site Scripting (XSS) so I'd recommend outputting the variable through htmlspecialchars() .
Within the <form> tag in your HTML code, insert: <input type="hidden" name="userid" id="userid" value="3434"> Code (markup): And then in the PHP code, you get the value: echo $_POST['userid']/$_GET['userid']; //Depending on form type PHP: Peace,
Did you mean, the user will input an URL (for example "http://www.somesite.com/blahblah&_moon=3435435") to your form, and your script should print "3435435" ?
Nope theres a url "http://www.somesite.com/blahblah&_moon=343543" that always has _moon value with a different location to the FORM
I dont understand what you want. the solution posted by Randombase is close, although I would do this: use htmlentities else your conna get some XSS attacks going on.
ok your saying get _moon, that would get _moon from the current url i need it from a different url that the form is on
$url = 'http://www.somesite.com/blahblah&_moon=3435435'; $QUERYVAR= parse_url($url, PHP_URL_QUERY); $GETVARS = explode('&',$QUERYVAR); foreach($GETVARS as $string){ list($is,$what) = explode('=',$string); echo "$is -> $what<br/>"; } PHP: Peace,