Jump to content

Using a variable from a form with a Link button


doubleflashstyle

Recommended Posts

I'm new to PHP/HTML and basically want to have an address bar on my site that redirects to a link,which changes depending on what the user types, after he clicks on a button.

 

I was using an example and everything there works, but I don't understand how to get something new to work:

 

So I have a Form:

<INPUT TYPE = "Text" VALUE ="" NAME = "ComID" >

<INPUT Name = "Submit1" TYPE = "Submit" VALUE = "Submit" onClick="MM_goToURL('parent','http://www.IWANTMY_ComID_SITEHERE!!.com');return document.MM_returnValue" >

 

How can I get the "ComID" variable (what the user types) to work with the MM_goToURL redirect thing, so that the user enters the address and when he clicks on it, is redirected there?

 

how would I replace 'http://www.IWANTMY_ComID_SITEHERE!!.com'  with a variable ?

 

I also have a php part below to pick it up:

 

<?PHP

$ComID = $_POST['ComID'];

print($ComID);

?>

 

 

That gives a highlightable bit of text that is the link but I want to have it redirect after pressing the button..

 

 

 

And this is the goToURL() function:

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_goToURL() { //v3.0

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args[i+1]+"'");

}

//-->

</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.