Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to collect info in a form and send it in a url string? 2

Status
Not open for further replies.

jburnard

Technical User
Mar 5, 2009
5
US
Hello Folks!

This is my first post, very glad to find this site!

I recently purchased a set of php scripts that manage email lists for you. If you put them on your server and use certain commands via a url string it will let people add their emails to a list etc.

My questions is: If I create a form for people to submit their email, first name, etc. how do I then plug that information into URL? I know how to create the URL to access my list manager I just don't know how to incorporate people from the web giving me their info and then creating the correct URL string. I hope that makes sense.

Thank yo for reading!
 
when you create your form set its method to GET, this will automatically take everything from the form and stick it into the URL.

For example:

Code:
<form action="phpscript.php" [red]method="GET"[/red]>
Name: <input type=text name="persons_name">
Email: <input type=text name="email">

<input type=submit name="send" value="Add to list"> 
</form>


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Ah right of course. Thank you for the quick reply. I should have been more specific in my question though. For example here is my url string.

ww.mywebsite.com/mlm/mlm.php?cmd=subscribe&list=LIST_NAME&email=useremail@whatever.com&firstname=whatever&lastname=whatever&company=whatever

So, where I put the bold "whatever" is the data I would get from the form but of course I still need to keep the rest of the url in tact.

Any idea how I would take the form data and get it into the appropriate places in that url string? Thanks again for reading!
 
Just add hiiden fields for the paramaters that you don't want to change:

Code:
<form action="[URL unfurl="true"]www.mywebsite.com/mlm/mlm.php"[/URL] method="GET">
[red]<input type=hidden name=cmd value="subscribe">
<input type=hidden name="list" value="LIST_NAME">[/red]
<input type="text" name="email">
<input type="text" name="firstname">
<input type="text" name="lastname">
<input type="text" name="company">
<input type=submit name="send" value="process values">

</form>

That will generate the URL string in the same fashion you have it, but will replace the values for the contents of the input fields.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
As this refers to PHP, realize there is also a nifty PHP forum here.

forum434
 
Many thanks, this is just what I needed!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top