Jump to content

[SOLVED] help with my Nearly finished Script


winmastergames

Recommended Posts

Welll ive got this script picture below

examplelt0.jpg

 

What i need to do is there is a form at the top i want it so the user fills in that form and there is buttons (4 of them) when the user clicks them i want the form data to use the GET function like indexx.php?title=Welcome&slogan=Welcome ETC i want some javascript to get that link and insert it into the form boxes below where it has URL 1,2,3 and 4

 

And Ideas?

well it doesnt have in Javascript in it cause i dont know how to do it but here it is

<html>
<head>

</head>
<body>
<form action="index.php" method="get">
Title: <input type="text" name="title" /><br>
slogan: <input type="text" name="slogan" /><br>
<hr>
Paragraph 1 Title: <input type="text" name="para-1" /><br>
Paragraph 1 Section 1 Body: <input type="text" name="para-1sec1body" /><br>
Paragraph 1 Section 2 Body: <input type="text" name="para-1sec2body" /><br>
Paragraph 1 Section 3 Body: <input type="text" name="para-1sec3body" /><br>
<hr>
Paragraph 2 Title: <input type="text" name="para-2" /><br>
Paragraph 2 Section 1 Body: <input type="text" name="para-2sec1body" /><br>
Paragraph 2 Section 2 Body: <input type="text" name="para-2sec2body" /><br>
<br>
Sidebar 1 Title: <input type="text" name="sidebar1title" /><br>
Sidebar 1 Body: <input type="text" name="sidebar1body" /><br>
<br>
Sidebar 2 Title: <input type="text" name="sidebar2title" /><br>
Sidebar 2 Body: <input type="text" name="sidebar2body" /><br>
<hr>
Sidebar 3 Title: <input type="text" name="sidebar3title" /><br>
Sidebar 3 Body: <input type="text" name="sidebar3body" /><br>
<hr>
<input type="button" name="sidebar3body" value="Submit to Page 1">
<input type="button" name="sidebar3body" value="Submit to Page 2">
<input type="button" name="sidebar3body" value="Submit to Page 3">
<input type="button" name="sidebar3body" value="Submit to Page 4">
<hr>
<form action="index.php" method="get">
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" name="link1url" id="1" /><br>
Link 2 Text: <input type="text" name="link2text"/><br>
Link 2 Url: <input type="text" name="link2url" id="2" /><br>
Link 3 Text: <input type="text" name="link3text" /><br>
Link 3 Url: <input type="text" name="link3url" id="3" /><br>
Link 4 Text: <input type="text" name="link4text" /><br>
Link 4 Url: <input type="text" name="link4url" id="4" /><br>
<hr>
<input type="submit" />
</form>
</body>

</html>

 

It will be great if someone could make it do what i want explained above leave the rest cause my code is kinda messy :)

Is anyone here tring to help me make this or should i just die in my pool of blood

 

That statement is not a good way to get help and yes, I am trying to come up with something for you; but it may take me a little bit. Have a little bit of patience; I mean your getting free help here, it's not like you are paying for a service.

ok, so I made you a demo and then you will have to go from there; because I could not figure out exactly how you wanted to get the query string from the other fields; you will have to do that on your on. but I think this will give you a good starting point.

 

<html>
<head>
<script language="javascript">
function updateField1(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function updateField2(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function putIt2gether(Entry,Entry2,place2go)
{
var first = document.getElementById(Entry).value;
var second = document.getElementById(Entry2).value;
document.getElementById(place2go).value = "title" + "=" + first + "&" + "slogan" + "=" + second;
}
</script>
</head>
<body>
Title: <input type="text" name="title" onkeyup="updateField1('hide1',this.value)" /><br>
slogan: <input type="text" name="slogan" onkeyup="updateField2('hide2',this.value)" /><br>
<hr>
<form action="index.php" method="get">
<input type="button" value="Submit 1" onclick="putIt2gether('hide1','hide2','text1')">
<hr>
<input type="hidden" id="hide1">
<input type="hidden" id="hide2">
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" id="text1" name="link1url" id="1" /><br>
<hr>
<input type="submit" />
</form>
</body>

</html>

 

UPDATE

 

here is a little bit of a more flexible version. this version will let you change your two variables in the function's parameters:

 

<html>
<head>
<script language="javascript">
function updateField1(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function updateField2(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function putIt2gether(Entry,Entry2,place2go,var1,var2)
{
var first = document.getElementById(Entry).value;
var second = document.getElementById(Entry2).value;
document.getElementById(place2go).value = var1 + "=" + first + "&" + var2 + "=" + second;
}
</script>
</head>
<body>
Title: <input type="text" name="title" onkeyup="updateField1('hide1',this.value)" /><br>
slogan: <input type="text" name="slogan" onkeyup="updateField2('hide2',this.value)" /><br>
<hr>
<form action="index.php" method="get">
<input type="button" value="Submit 1" onclick="putIt2gether('hide1','hide2','text1','title','slogan')">
<hr>
<input type="hidden" id="hide1">
<input type="hidden" id="hide2">
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" id="text1" name="link1url" id="1" /><br>
<hr>
<input type="submit" />
</form>
</body>

</html>

 

 

Ummm well it doesnt really do it proberly It needs

index.php?

infront of all the code thats generated in the Link 1 Url Textbox at the bottom is there a easy way to do this Ill try and do this myself but if you know can you post it :)

<html>
<head>
<script language="javascript">
function updateField1(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function updateField2(Entry, ReEntry)
{
document.getElementById(Entry).value = ReEntry;
}
function putIt2gether(Entry,Entry2,place2go,var1,var2)
{
var first = document.getElementById(Entry).value;
var second = document.getElementById(Entry2).value;
document.getElementById(place2go).value = "index.php?" + var1 + "=" + first + "&" + var2 + "=" + second;
}
</script>
</head>
<body>
Title: <input type="text" name="title" onkeyup="updateField1('hide1',this.value)" /><br>
slogan: <input type="text" name="slogan" onkeyup="updateField2('hide2',this.value)" /><br>
<hr>
<form action="index.php" method="get">
<input type="button" value="Submit 1" onclick="putIt2gether('hide1','hide2','text1','title','slogan')">
<hr>
<input type="hidden" id="hide1">
<input type="hidden" id="hide2">
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" id="text1" name="link1url" id="1" /><br>
<hr>
<input type="submit" />
</form>
</body>

</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.