top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to pass parameter via URL in PHP

0 votes
896 views

I would like to know how can I pass a parameter via URL using control value on the form.
Something like myPage.php?MyID=txtMyID.value
I can use myPage.php?MyID=1, but cannot use myPage.php?MyID=txtMyID.value.

posted May 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

This is more a js question. Because form.controlname.value is only available in javascript. A similar question answered long ago on Stackoverflow is
http://stackoverflow.com/questions/9009311/get-change-remove-url-parameters-with-jquery/9009558#9009558

And here is function that does it using pure javascript.
http://shiplu.mokadd.im/61/parse-query-string-by-pure-javascrirpt/

answer May 20, 2013 by anonymous
Thanks for the message and helping, Your js looks like to parse URL.Please let me know if I am wrong, Do you have any code to generate the URL parameter using control value?
You can generate the url using string concatenation operator +.
To keep it consistent and out of error you need to reverse the same function i have given then you can perform both. The idea is there.
Similar Questions
+2 votes

I want to build a A URL Shortener service in my PHP based Website without use of any thirdparty tool. Any clue or opensource would be a great help?

+2 votes

Hi,I have a url some thing like this https://google.com/.I need to replace end of slash in the url.

I need url like this https://google.com.

+1 vote

I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief.

I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs...

Given some example text here with carefully crafted cases:

// another comment here

function bookmarksite(title,url){
 if (window.sidebar) // firefox
 window.sidebar.addPanel(title, url, "");
 else if(window.opera &
 elem.setAttribute('href',url);
 elem.setAttribute('title',title);
 elem.setAttribute('rel','sidebar');
 elem.click();
 } 
 else if(document.all)// ie
 window.external.AddFavorite(url, title);
}

I've tried so many variations and hunted on StackOverflow, Google, etc. and what would seem like a task already solved, doesn't seem to be.

This is "close", but still matches //foo.com (omitting the : of course)

s*(?!:)//.*?$ (count it as '/m' multiline)

This ultimately ends up in a PHP line of code like so:

$sBlob = preg_replace("@s*//.*?$@m",'',$sBlob);

Here are some other links of stuff I've found and tried to experiment with varying degrees.

http://stackoverflow.com/questions/4568410/match-comments-with-regex-but-not-inside-a-quote
http://stackoverflow.com/questions/611883/regex-how-to-match-everything-except-a-particular-pattern
http://stackoverflow.com/questions/11863847/regex-to-match-urls-but-not-urls-in-hyperlinks
http://stackoverflow.com/questions/643113/regex-to-strip-comments-and-multi-line-comments-and-empty-lines

...