Forum Moderators: open
<script language="javascript" src="index.php?color=blue&shape=round"></script>
I'd like to help them construct this URL using javascript in a form. I keep thinking of Google Adsense as a good example. (The part where you can select the size and color of the ad)
Lets say the user has the option of specifying shape and color.
<form>
<select name="color">
<option value="">Select a Color</option>
<option value="color=blue">blue</option>
<option value="color=red">red</option>
</select>
<select name="shape">
<option value="">Select a Shape</option>
<option value="&shape=round">round</option>
<option value="&shape=square">square</option>
</select>
<textarea name="output">
<script language="javascript" src="index.php?**ADD FIELDS HERE**"></script>
</textarea>
</form>
It looks like I just need to add the select values onto the end of index.php? inside the text area.
As a further example, if they want content that is "round" and "blue" then I would need to provide the below in the text area.
<script language="javascript" src="index.php?color=blue&shape=round"></script>
I know very little about javascript but can't seem to even grasp this enough to search for examples.
Can anyone help me out here?
<select name="color">
<option value="">Select a Color</option>
<option value="blue">blue</option>
<option value="red">red</option>
</select>
<select name="shape">
<option value="">Select a Shape</option>
<option value="round">round</option>
<option value="square">square</option>
</select>
<input type="submit">
</form>
That would be the best way to go, since you don't know javascript. then do all of your coding on the server side