Jump to content

Recommended Posts

Well im making a script so users can make there own website for free and stuff. But is possible to have a form that uses the GET function and submits it and that link stuff comes out like this

page.php?name=bob&last=gates

I want that code after they have submited it to go into the Textbox where they first clicked the link to Add Page

 

If you know what i mean?? its kind of confusing

Link to comment
https://forums.phpfreaks.com/topic/86856-solved-help-with-my-php-scripts/
Share on other sites

Yah, your quandry is confusing...

 

You can access form variables submitted by the GET method as

$_GET['name'] and $_GET['last']

-OR-

$_REQUEST['name'] and $_REQUEST['last'] (this method gets variables submitted with either GET or POST)

Yea i tried that its a bad idea...

 

But what about is there a way that you can fill out a form on a page and there is another form below that one where it has some textboxes to place the stuff like page.php?name=bob&last=gates Right and places the code there and there will be 4 buttons like place in textbox 1 and 2,3,4 like that Is that possible?

Ill give you the Form Code i have here

 

<form action="index.php" method="get">
Title: <input type="text" name="title" /><br>
slogan: <input type="text" name="slogan" /><br>
<br>
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>
<br>
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>
<br>
Sidebar 3 Title: <input type="text" name="sidebar3title" /><br>
Sidebar 3 Body: <input type="text" name="sidebar3body" /><br>
<br>
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" name="link1url" /><br>
Link 2 Text: <input type="text" name="link2text" /><br>
Link 2 Url: <input type="text" name="link2url" /><br>
Link 3 Text: <input type="text" name="link3text" /><br>
Link 3 Url: <input type="text" name="link3url" /><br>
Link 4 Text: <input type="text" name="link4text" /><br>
Link 4 Url: <input type="text" name="link4url" /><br>
<input type="submit" />
</form>

And at the bottom there is link 1 url link 2 url and 3 and 4 Thats where i want the code to be

well i have a PHP script HERE

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $_GET["title"]; ?> - <?php echo $_GET["slogan"]; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #A53512}
-->
</style>
</head>
<body>
<!-- 

COPYRIGHT INFORMATION
-+-+-+-+-+-+-+-+-+-+-

If you wish to use this template for a non-profit organisation,
such as state funded schools & colleges, charities, blogs etc, 
then you are free to do with the copyright information as you 
wish. I would appreciate a link back, but it isn't neccessary.

For all other users of this template, please leave the copyright
info in the footer intact. I made this template in my own time,
and all I ask is you leave the copyright info intact so that 
others can find the oswd site and me!

If you wish to remove the copyright information, I can not stop
you, but a donation would be appreciated. To get in touch email
me at info@now-design.co.uk or simply paypal to that same address.

Good luck, if you are struggling with the modification, do get in
touch as I am available for paid work.

Thanks!

Tjobbe Andrews - NOW:design - info@now-design.co.uk

-->
<!-- 
This design is part of the [in] business template downloaded from the oswd.org site 

The stylesheet and template where made by Tjobbe Andrews from NOW:design www.now-design.co.uk
-->
<div class="all">
<div class="box">
<!-- The menu, tabs -->
  <div class="menu"><a href="<?php echo $_GET["link1url"]; ?>"><?php echo $_GET["link1text"]; ?></a><a href="<?php echo $_GET["link2url"]; ?>"><?php echo $_GET["link2text"]; ?></a><a href="<?php echo $_GET["link3url"]; ?>"><?php echo $_GET["link3text"]; ?></a><a href="<?php echo $_GET["link4url"]; ?>"><?php echo $_GET["link4text"]; ?></a></div>
<!-- The header -->
	<div class="header"><img alt="" style="float:right; " src="images/www.jpg" width="225" height="95" />
	  <h1><?php echo $_GET["title"]; ?></h1>
	  <div class="clearfix"></div>
  </div>
<!-- the news bar, or right hand column -->
	<div class="newsbar">
	<h1><?php echo $_GET["sidebar1title"]; ?></h1>
	<div class="p2"><?php echo $_GET["sidebar1body"]; ?></div>
	<h1><?php echo $_GET["sidebar2title"]; ?></h1>
	  <div class="p2"> 
	    <p><?php echo $_GET["sidebar2body"]; ?></p>
      </div>
	  <h1><?php echo $_GET["sidebar3title"]; ?></h1>
	  <div class="p2"> 
	    <p><?php echo $_GET["sidebar3body"]; ?></p>
	  </div>
	</div>
<!-- main content area-->
	<div class="content"> 
	  <h1><?php echo $_GET["para-1"]; ?></h1>
	  <p><?php echo $_GET["para-1sec1body"]; ?></p>
	  <p><?php echo $_GET["para-1sec2body"]; ?></p>
	  <div class="p1"><?php echo $_GET["para-1sec3body"]; ?></div>
	  <h1><strong><?php echo $_GET["para-2"]; ?></strong></h1>
	  <p><?php echo $_GET["para-2sec1body"]; ?></p>
	  <p><?php echo $_GET["para-2sec2body"]; ?></p>
	</div>
	<div class="clearfix"></div>
<!-- footer, copyright area - please do not remove!-->
	<div class="footer"><?php echo $_GET["title"]; ?> © 2008 |
	  Template from <a href="http://www.oswd.org/">oswd.org</a></div>
</div>
</div>

</body>
</html>

And there is the

<?php echo $_GET["title"]; ?>

In and around the script and well that script is a template as you can see. and then I have the following form so you can put a title and text into the webpage But now i want it so you can have multipule pages and on the form i have URL 1 url 2 url 3 url 4 I want another form that can insert the URL into there when they have made another page Like on this Page you will have this Come out after you have Put all your Text in

index.php?title=Welcome+To+a+website&slogan=Great+this+is+cool&para-1=Welcome&para-1sec1body=Welcome+to+bobnarly%27s+website+please+use+the+link+above+to+navigate+around&para-1sec2body=More+Text&para-1sec3body=More+Text&para-2=More+Text&para-2sec1body=More+Text&para-2sec2body=More+Text&sidebar1title=More+Text&sidebar1body=More+Text&sidebar2title=More+Text&sidebar2body=More+Text&sidebar3title=More+Text&sidebar3body=More+Text&link1text=&link1url=&link2text=&link2url=&link3text=&link3url=&link4text=&link4url=

But when a another page is greated like Page 2 i want the Text to be inserted into URL 2 on the Form thats coming up below How will i do this

 

Or is there a better way to do this

 

HERE is the FORM

<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>
Link 1 Text: <input type="text" name="link1text" /><br>
Link 1 Url: <input type="text" name="link1url" /><br>
Link 2 Text: <input type="text" name="link2text" /><br>
Link 2 Url: <input type="text" name="link2url" /><br>
Link 3 Text: <input type="text" name="link3text" /><br>
Link 3 Url: <input type="text" name="link3url" /><br>
Link 4 Text: <input type="text" name="link4text" /><br>
Link 4 Url: <input type="text" name="link4url" /><br>
<hr>
<input type="submit" />
</form>

I thought about it a bit more and here is a diagram

examplelt0.jpg

 

As you can see the user will type in the top form and there are 4 buttons i want them to submit the index.php?title=Welcome&slogan=Welcome and so on into the textboxes at the bottom with URL 1,2,3 and 4

 

Is that more understanding

*Sigh*

<script type="text/javascript">
var inputs = document.getElementsByTagName('input');
var urlstr = 'index.php?';
for(var i = 0; i < inputs.length; i++) {
var input = inputs[i];
if(input['name'].substr(0, 4) == 'link') continue;
if(urlstr != 'index.php?') urlstr += '&';
urlstr += input['name'] + '=' + input['value'];
}
</script>

That will create your index.php?blah=blah&blah2=blahblah in the variable 'urlstr'. Now all you need to do is attach onlick events to your four buttons to give the link boxes the value of urlstr.

 

I also refuse to write any more code for you because I'm tired, I hate javascript and I think that if you manage to do the rest yourself you'll be much better off than if I had told you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.