Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7687303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:40:26+00:00 2026-05-31T19:40:26+00:00

I am having trouble appending multiple variables to the end of a url using

  • 0

I am having trouble appending multiple variables to the end of a url using javascript. The user provides input on the page using a select menu and textarea. Using just the textarea works, but I’m not able to include the select menu.

<?php
$price = $_GET['price'];
$title = $_GET['title'];
$retailer = $_GET['retailer'];
$img = $_GET['img'];
$link = $_GET['link'];
$desc = $_GET['desc'];    
?>

<textarea rows="3" id="textarea" class="input-xlarge" placeholder="Size, color, style, etc" name ="options"></textarea>

<select style="width: 130px;" id="quantity" class="span2">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        </select>

<script language="javascript">
    function test()
{
    var val=document.getElementById("textarea").value;  
    var val=document.getElementById("quantity").value; 
    var hrf="viewcart.php?retailer=<?php echo $retailer?>&link=<?php echo $link; ?>&price=<?php echo $price; ?>&title=<?php echo $title; ?>&options="+val;
    document.getElementById("a_link").href=hrf;
}
</script>

<a href ="#" id="a_link" onclick="test();" class="btn btn-success" type="submit">
    <i class="icon-shopping-cart icon-white"></i>  Add to Cart
</a>

The line I am trying to alter is:

    var hrf="viewcart.php?retailer=<?php echo $retailer?>&link=<?php echo $link; ?>&price=<?php echo $price; ?>&title=<?php echo $title; ?>&options="+val;

I tried to have the below but it didn’t work:

    var hrf="viewcart.php?retailer=<?php echo $retailer?>&link=<?php echo $link; ?>&price=<?php echo $price; ?>&title=<?php echo $title; ?>&options="+val + “&quantity=” + quantity;

Any ideas on how to get this to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:40:27+00:00Added an answer on May 31, 2026 at 7:40 pm

    Use this buddy,

    var quantity = document.getElementById("quantity").options[document.getElementById("quantity").selectedIndex].value;
    
    var val=document.getElementById("textarea").value;
    
    var hrf="viewcart.php?retailer=<?php echo $retailer?>&link=<?php echo $link; ?>&price=<?php echo $price; ?>&title=<?php echo $title; ?>&options="+val + “&quantity=” + quantity;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble with a mysql grant statement. I want a user who has: readonly
Im having trouble using a .NET COM in vb6, It compiles ok and I
I having trouble in dividing the HTML frames. I have been using the following
I'm having trouble appending the values from a list of lists into a html
I'm having trouble appending a get() to a dynamically created div. I've marked with
I'm having trouble figuring out the proper way to update nested data using Google
I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I'm having trouble appending a list to another list. Below is my code. When
I'm having trouble working out how to pass in arguments into transactions when using
Having trouble when trying to create a class using another class(and 2 inner classes),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.