Hi All,
I am designing a feedback page for my website and have carried info through the url to the feedback page from a previous page. This url contains a name of an individual, in between two symbols = and &
The url of the feedback page looks something like this:
www.website.com/feedback.html?name=David_Smith&
First, I have used a form to display the information so that the user can see who they have selected, ie. extract the first and last names from the url. (The script following the form extracts the name from the url so that it can be displayed by the form, not exactly sure why it does so in this particular order but it seems to work so far).
This is the code I have used to do this:
<FORM NAME=“SWnamefunc”>
<div align=“left”>
<INPUT TYPE=“hidden” NAME=“yoyo” SIZE=“35”>
</div>
</FORM>
<div align="left">
<p>
<SCRIPT LANGUAGE="javascript">
var locate = window.location
document.SWnamefunc.yoyo.value = locate
var text = document.SWnamefunc.yoyo.value
function delineate(str){
theleft = str.indexOf(“=”) + 1;
theright = str.lastIndexOf(“&”);
return(str.substring(theleft, theright));
}
document.write("You have requested a class with: " +delineate(text));
</SCRIPT>
I have two questions:
1. I want to now use the name I have extracted, displayed through the variable text above, and create a string (or label as described below) from that variable - so that it can be then sent to a php script. The php script then emails to me all the information inputted by the user/surfer.
How do I do this?
2. What I have done is display the names separated by an _ . Can anyone tell me how I separate the names out and display them without the underscore (in the form above)?
I am quite a basic coder and have very little knowledge of programming language so any help would be greatly appreciated. If you could write the actual code required - that would be great (ie. instead of saying you need to “do this”, please type the code).
P.S.
The following code is what I have later used to send the information to a script.
<form action="feedback.php" method="post">
<table border=“0” cellpadding=“8” cellspacing=“8” summary=“feedback form”>
<tr><td width=“115”><label for=“tswname”><span class=“Bold”>*</span>Name</label>:</td><td width=“361”><input type=“text” name=“fullname” id=“tswname” size=“25” /></td></tr>
I think I need to maybe create a label for the name text (and then direct the form to send the label info to the script). Is this right? And if so - how do I code this?
Any help would be much appreciated. Cheers!