469,333 Members | 4,679 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,333 developers. It's quick & easy.

Linking contents of text box to anchor HREF

30
I want to send sms from my sajt, i have some code but i don't know enaught.

I have an account in one of sms service server ...

code:
Expand|Select|Wrap|Line Numbers
  1. <a href = "http://www.myaccount.com/artxcenter.com/sendsms.php?username=xxx&password=xxx&from=xxx&to=xxxx&text=xxx"> Click here to send sms </a>
[Please use CODE tags when posting source code. Thanks! --pbmods]

if you write right username and password and to (number of phone you will send sms ) .

My problem:
how to link with TEXT box
plz help me
Jun 3 '07 #1
17 6175
pbmods
5,821 Expert 4TB
Changed thread title to better match contents.

Heya, aRTx. Welcome to TSDN!

I'm moving this thread to the JavaScript forum where it will get more relevant exposure.
Jun 4 '07 #2
acoder
16,027 Expert Mod 8TB
My problem:
how to link with TEXT box
plz help me
Say you have a textbox with an id of "username", then you would access it using:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("username").value
To add this to the URL, you could call a function which retrieves the values from the textboxes and adds them, e.g.
Expand|Select|Wrap|Line Numbers
  1. urlparams = "username="+document.getElementById("username").value;
  2. urlparams += "&password="+...//etc.
Jun 4 '07 #3
aRTx
30
thnx for help, but i don't know how to use your code to resolve this problem, I'm biginer in this area.


Please post an concrete example plz....

I APPRECIATE your knowlodge...
Jun 4 '07 #4
acoder
16,027 Expert Mod 8TB
Post some HTML (your form) so we can work with that.
Jun 4 '07 #5
aRTx
30
Post some HTML (your form) so we can work with that.
i have upload something about this "sms links" sms-links.zip

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. </head>
  5.  
  6. <body>
  7. <form id="form1" name="form1" method="post" action="">
  8.   <label><br />
  9.   Mobile number to:
  10.   <input type="text" name="to" id="to" />
  11.   </label>
  12. </form>
  13. <p>&nbsp;</p>
  14. <form id="form2" name="form2" method="post" action="">
  15.   <label>here sms text
  16.   <textarea name="text" id="text" cols="45" rows="5"></textarea>
  17.   </label>
  18. </form>
  19. <p>&nbsp;</p>
  20. </body>
  21. </html>
i don't know how to use it:
Expand|Select|Wrap|Line Numbers
  1. https://myaccount.smsdiscount.com/clx/sendsms.php?username=xxxxxxxxxx&password=xxxxxxxxxx&from=xxxxxxxxxx&to=xxxxxxxxxx&text=xxxxxxxxxx

plz help to do it ....
Jun 4 '07 #6
acoder
16,027 Expert Mod 8TB
You have two forms. Make them into one.

Do you only want the "to" and "text" fields in the form. Where will the other fields be set?

Ok, let's assume that you only want the "to" and "text" fields from the form. First of all, in your link, change the href to "#" and add an onclick to call a function:
[HTML]<a href="#" onclick="sendsms()">...</a>[/HTML]
In this function, set the parameters for the url:
Expand|Select|Wrap|Line Numbers
  1. function sendsms() {
  2.  var to = "to="+encodeURIComponent(document.getElementById('to').value);
  3.  // repeat for the rest of the fields then..
  4.  location.href = "sendsms.php?" + username + "&" + password ... + "&" + to + ...;
  5. }
Jun 5 '07 #7
aRTx
30
the code:
[HTML]<html>
<head>


<script>

function sendsms() {
var to = "to="+encodeURIComponent(document.getElementById(' to'). value);
// repeat for the rest of the fields then..
location.href = "sendsms.php?" + username + "&" + password ... + "&" + to + ...;
}
</script>



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label><br />
Mobile number to:
<input type="text" name="to" id="to" />
</label>
</form>
<p>&nbsp;</p>
<form id="form2" name="form2" method="post" action="">
<label>here sms text
<textarea name="text" id="text" cols="45" rows="5"></textarea>
</label>
</form>
<p>&nbsp;</p>
<a href="https://myaccount.smsdiscount.com/clx/sendsms.php?username=artx&password=bumbum&to&text" onclick="sendsms()">...</a>
</body>
</html>[/HTML]


this code when excute return a failed mesage:
[HTML] <?xml version="1.0" encoding="utf-8" ?>
- <SmsResponse>
<version>1</version>
<result>0</result>
<resultstring>failure</resultstring>
<description>The parameter to (destination number) is missing</description>
<endcause />
</SmsResponse>[/HTML]
Jun 5 '07 #8
aRTx
30
I have write some thing please chek it...
[HTML]<html>
<head>


<script>

function sendsms() {
var username = "account";
var password = "bllablla";
var to = "to="+encodeURIComponent(document.getElementById(' to'). value);
var text = "text="+encodeURIComponent(document.getElementById ('text'). value);


// repeat for the rest of the fields then..
location.href = "sendsms.php?" + username + "&" + password + "&" + to;
}
</script>



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label><br />
Mobile number to:
<input type="text" name="to" id="to" />
</label>
</form>
<p>&nbsp;</p>
<form id="form2" name="form2" method="post" action="">
<label>here sms text
<textarea name="text" id="text" cols="45" rows="5"></textarea>
</label>
</form>
<p>&nbsp;</p>
<a href=" what to write here plz..." onclick="sendsms()">...</a>
</body>
</html>[/HTML]

where is the mistake?.
Jun 5 '07 #9
acoder
16,027 Expert Mod 8TB
Replace sendsms.php in the sendsms function with the full URL:
https://myaccount.smsdiscount.com/clx/sendsms.php?

Also, you will need to change username and password to include "username=" and "password=". You've also forgotten to add the 'text' to the url.

As for the href of the link, a hash (#) should suffice.
Jun 6 '07 #10
aRTx
30
if we have html code:

[HTML]<html>
<form>
<input type="text" name="fieldOne">
</form>
</html>
[/HTML]

how to get contets and with this contets make an link:
example:
http://www.herefromtextbox".com
Jun 6 '07 #11
aRTx
30
How to make and call a function wich can take contets from "textbox" by clik on a button

[HTML]
<HTML>
<form>
<input type="text" name="fieldOne">
</form>
</html>
[/HTML]

and then contets convert to a link:
www.contents.com
Jun 6 '07 #12
aRTx
30
I have a problem..
I am gona make a html form to send sms from my sajt.
i can send sms because i have an account in www.smsdiscout.com and they let us to send with a code

<a href="http://www.smsdiscount.com/clx/sendsms.php?username="xxx"&password="xxx"&to="xxx" &text="xxx"> Clik to send sms </a>

but how to turn it in a html form with textbox-es


I know i have post this problem more than one time, but i can't find concret code to do it...
Jun 6 '07 #13
r035198x
13,262 8TB
if we have html code:

[HTML]<html>
<form>
<input type="text" name="fieldOne">
</form>
</html>
[/HTML]

how to get contets and with this contets make an link:
example:
<A href="http://www.herefromtextbox".com[/QUOTE">http://www.herefromtextbox".com
Where do you want to put this link? Write a function which simply takes the value on the input box and sets it as the href of your link.
Jun 7 '07 #14
ak1dnar
1,584 Expert 1GB
[HTML]<HTML>
<head>
<script language="JavaScript" type="text/javascript">
function func_call(linkStr)
{
document.getElementById("link").innerHTML = '<a href="http://www.'+linkStr+'.com">'+linkStr+'</a>';
}
</script>
</head>
<body>
<div id="link"></div>
<form>
<input type="text" name="fieldOne" id="fieldOne" >
<input name="btn" value="CLICK" type="button" onclick="javascript:func_call(fieldOne.value);">
</form>
</body>
</html>
[/HTML]
Jun 7 '07 #15
aRTx
30
thnx very much,
you have resolve my problem i have post it in 14 way in this forum but you have do it in good way.


i am gona ask again

how to get from two textboxes and when you will click the link will be exceute in the same page
Jun 7 '07 #16
ak1dnar
1,584 Expert 1GB
thnx very much,
you have resolve my problem i have post it in 14 way in this forum but you have do it in good way.
Once you post a thread in the forum, you wont be able to get a answer shortly.You have to wait sometimes until another member comes to the thread.

how to get from two textboxes and when you will click the link will be exceute in the same page
Better if you can further explain it. The most suited way for this,you can post the coding that you made so far here in the forum.

Are you looking for something like this.

for the Onclick event of button you can pass both the text box values like this.
Expand|Select|Wrap|Line Numbers
  1. func_call(fieldOne.value,fieldTwo.value)
  2.  
then from your js function you have to accept two parameters.

Expand|Select|Wrap|Line Numbers
  1. function func_call(linkStr_1,linkStr_2)
  2. {
  3.  
  4. }
link will be exceute in the same page
I am waiting for your further details about this.
Jun 8 '07 #17
acoder
16,027 Expert Mod 8TB
Merged the threads - same topic.
Jun 8 '07 #18

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by nam | last post: by
1 post views Thread by Ang Talunin | last post: by
17 posts views Thread by Christopher Nelson | last post: by
16 posts views Thread by Thomas Maier-Komor | last post: by
1 post views Thread by Sudhakar | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.