Jump to content

Can I re-detect by what is a form?


chaos67731

Recommended Posts

I am making a demo page that I want to add a form to.

 

The way I want this for to work is.

 

Say you are at demo.com

 

Now you are a client I am working with so I have given you a number.

 

This form will as for that number and on submit it will take you to

 

demo.com/"client number"

Here is what I have done.

 

 

What is in my index.php

  <form>

  <form action="search.php">

    <input id="button" name="button" type="text" />

    <input type="button" value="SEARCH" >

  </form>

 

What is in my search.php

<?php

$newurl = "http://demo.mysite.com/";

$newurl .=$_GET['button'];

 

echo "$newurl";

 

/*header("Location: $newurl"); */

?>

 

 

--------------------------------------------------

I have also tried taking out the search.php  and having everything in index.php

 

 

  <form>

  <form>

    <input id="button" name="button" type="text" />

    <input type="button" value="SEARCH" >

  </form>

 

<?php

$newurl = "http://demo.mysite.com/";

$newurl .=$_GET['button'];

 

echo "$newurl";

 

/*header("Location: $newurl"); */

?>

 

 

 

Link to comment
Share on other sites

First off, you have a double <form>, second, you need to assign a method to your form (add method="get" inside the form tag).  Third, why are you echoing the URL before you send the header?  The header has to be sent before any output to the browser or you'll get an error, just take out the echo.  Fourth, did you put the header tag inside comment tags on purpose?

Fifth, not sure about a fifth, I didn't look it over too finely, just enough to catch some glaring errors.

Link to comment
Share on other sites

First off, you have a double <form>, second, you need to assign a method to your form (add method="get" inside the form tag).  Third, why are you echoing the URL before you send the header?  The header has to be sent before any output to the browser or you'll get an error, just take out the echo.  Fourth, did you put the header tag inside comment tags on purpose?

Fifth, not sure about a fifth, I didn't look it over too finely, just enough to catch some glaring errors.

 

 

The double  <form> was a miss type.

 

The header tag was in comments on purpose, I should of taken that out before posting.

 

 

This is now the full page that I have.  And it is still not working.

 

<?php

$newurl = "http://splash.findyoursearch.com/";

$newurl .=$_GET['button'];

 

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

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

<title>Demo Page</title>

<style type="text/css">

html { background:#799ABC url(images/site-bg.png) repeat-x top left; }

#main {

width:700px;

height:640px;

margin:50px auto;

border:0px solid #111;

background:url(images/logo-bk.png) no-repeat;

}

#main .opening {

padding-top:250px;

font-weight:bolder;

text-align:center;

text-transform:uppercase;

}

</style>

</head>

<body>

<div id="main">

  <p class="opening">To get to your demo splash page enter you client id in the search field below.</p>

  <p>

  <form method="get" >

    <input id="button" name="button" type="text" />

    <input type="button" value="SEARCH" >

  </form>

  </p>

</div>

</body>

</html>

 

 

 

 

Link to comment
Share on other sites

Here is a link to a testing site.

http://chaos67731.com/

 

 

And Here is all the code I have in it.

 

Any help would be great.

 

<?php

$newurl = "http://chaos67731.com/demo/";

$newurl .=$_GET['button'];

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

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

<title>Demo Page</title>

<style type="text/css">

html { background:#799ABC url(images/site-bg.png) repeat-x top left; }

#main {

width:700px;

height:640px;

margin:50px auto;

border:0px solid #111;

background:url(images/logo-bk.png) no-repeat;

}

#main .opening {

padding-top:250px;

font-weight:bolder;

text-align:center;

text-transform:uppercase;

}

</style>

</head>

<body>

<div id="main">

  <p class="opening">To get to your demo splash page enter you client id in the search field below.</p>

  <p>

  <center>

    <form method="get" action="">

      <input id="button" name="button" type="text" />

      <input type="button" value="SEARCH" />

    </form>

    <strong>

    <?php

  echo "$newurl";

  ?>

    </strong>

  </center>

  </p>

</div>

</body>

</html>

 

 

Link to comment
Share on other sites

Input type attribute should be submit.

 

    <form method="get" action="">
      <input id="button" name="button" type="text" />
      <input type="submit" value="SEARCH" />
    </form>

 

Or else use javascript to submit.

 <input type=”button” name=”buttonn” value=”Submit” onClick=”javascript:document.formName.submit();”>

Link to comment
Share on other sites

If I understand you correctly, you'll want something like this:

 

<?php
$newurl = "Location: http://chaos67731.com/demo/".$_GET['button'];
header ($newurl);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo Page</title>
<style type="text/css">
html { background:#799ABC url(images/site-bg.png) repeat-x top left; }
#main {
      width:700px;
      height:640px;
      margin:50px auto;
      border:0px solid #111;
      background:url(images/logo-bk.png) no-repeat;
}
#main .opening {
      padding-top:250px;
      font-weight:bolder;
      text-align:center;
      text-transform:uppercase;
}
</style>
</head>
<body>
<div id="main">
  <p class="opening">To get to your demo splash page enter you client id in the search field below.</p>
  <p>
  <center>
    <form method="get" action="http://chaos67731.com/">
      <input id="button" name="button" type="text" />
      <input type="submit" value="SEARCH" />
    </form>
    <strong>
    <?php
  echo "$newurl";
  ?>
    </strong>
  </center>
  </p>
</div>
</body>
</html>

 

I was just assuming the page URL for where this page is located was http://chaos67731.com/

If it is something different, you'll want to change the action= portion of the form tag to equal whatever the URL is.

The thing is, you want the submit to process at the top of this very page and then header to the website you want.  That is accomplished at the top with the parsing of the GET variable into the header, but first the submit has to point right back to the page so it will essentially "refresh" and start from the beginning.

Link to comment
Share on other sites

Oh, and I overlooked this at first, you'll want the top to look like this to prevent the code from triggering the first time the person visits the page:

 

<?php
if (isset($_GET)){
$newurl = "Location: http://chaos67731.com/demo/".$_GET['button'];
header ($newurl);}
?>

 

Hope that didn't cause too much headache, I was lost in a fog yesterday :)

Link to comment
Share on other sites

That did not seem to work,  as soon as I go to chaos67731.com it auto redirects me to  http://chaos67731.com/demo/ .

 

This thing has been such a pain for the last week, I have for now just left it where the link pops up after the client puts in the client id.

 

 

 

 

Oh, and I overlooked this at first, you'll want the top to look like this to prevent the code from triggering the first time the person visits the page:

 

<?php
if (isset($_GET)){
$newurl = "Location: http://chaos67731.com/demo/".$_GET['button'];
header ($newurl);}
?>

 

Hope that didn't cause too much headache, I was lost in a fog yesterday :)

Link to comment
Share on other sites

Try this instead:

 

if (isset($_GET['button'])){

 

To prevent the auto-redirect.

 

I ended up getting it to work, you can test it out at chaos67731.com (I will take down some time or a nother) just type in demo/1000

<?php
$newurl = "http://chaos67731.com/";
$newurl .=$_GET['client_number'];

if(isset($_POST['client_number']) && is_dir($_POST['client_number'])) {
    header('Location: /'.$_POST['client_number']);
} elseif(isset($_POST['client_number'])) {
    $error = '<span class="error"><p>Invalid client number!</p> </span><br>If You Have Any Questions Or Are Having Problems Getting To Your Splash Page Feel Free To Send Me An E-Mail At <span><a href="mailto:chaos67731@gmail.com">chaos67731@gmail.com</a> </span>';
}
?>

 

The Full page look like this if it would help anyone!

<? ob_start("ob_gzhandler"); ?>  
<?php
    $newurl = "http://chaos67731.com/";
    $newurl .=$_GET['client_number'];
    
    if(isset($_POST['client_number']) && is_dir($_POST['client_number'])) {
        header('Location: /'.$_POST['client_number']);
    } elseif(isset($_POST['client_number'])) {
        $error = '<span class="error"><p>Invalid client number!</p> </span><br>If You Have Any Questions Or Are Having Problems Getting To Your Splash Page Feel Free To Send Me An E-Mail At <span><a href="mailto:chaos@gmail.com">chaos67731@gmail.com</a> </span>';
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofallow" />
<title>Demo Page</title>
<style type="text/css">
html { background:#799ABC url(images/site-bg.png) repeat-x top left; }
#main {
	width:700px;
	height:640px;
	margin:50px auto;
	border:0px solid #111;
	background:url(images/logo-bk.png) no-repeat;
	text-align:center;
}
#main .opening {
	padding-top:250px;
	font-weight:bolder;
	text-align:center;
	text-transform:uppercase;
}
#main a {
	padding-top:30px;
	text-decoration:none;
	color:#00F;
	font-size:18px;
	outline:none;
}
a focus { outline:none; }
#main span {
	font-size:18px;
	color:#00F;
	padding:5px;
	text-transform:uppercase;
	text-decoration:underline;
}
.error p {
	color:#f00;
	font-size:24px;
	text-transform:uppercase;
}
</style>
</head>
<body>
<div id="main">
  <p class="opening">To get to your demo splash page enter your<br />
    client id in the search field below and then press enter on your pc.</p>
  <center>
    <form method="post" action="">
      <input id="button" name="client_number" type="text" />
      <input value="Search" type="submit" />
    </form>
  </center>
  <?php echo $error; ?> </div>
</body>
</html>

 

Link to comment
Share on other sites

Now that I have that working I want to add a password for ever client.

 

So the client will put in there number and email to get to the folder. I would like to do this with out sql

 

On top of that I would like a funny message to pop up when the enter the wrong number or password 5 times.

Link to comment
Share on other sites

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.