Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > NEWBIE: Meta Refresh Problem
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th June 09:25
the numerator
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


Hi, as you can see from the subject, I'm a newbie. Ok, let me get to
the core: there's this site called http://www.youaremighty.com/.
Suppose your name is Bill Gates. You type this onto your address bar:
http://bill.gates.youaremighty.com/. George Bush is
http://george.bush.youaremighty.com/. These pages dynamically makes a
flash file made personally for you. Try your name to find out what I
mean.

I wanted to make a PHP script where a use will type in their first name
and their last name and then the PHP script will do its thing and meta
refresh to the page. Here's the HTML form page:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Christ Warriors Online - Stuff - You Are Mighty</title>
<link rel="stylesheet" type="text/css" href="../styles/default.css">
</head>

<body>

<form action="you_are_mighty.php" name="mighty">
First Name: <input name="firstname" class="input" type="text"
size="20"><p>Last
Name: <input name="lastname" class="input" type="text" size="20"></p>
<p><input name="submit" class="input" type="submit"
value="Submit"></p>
</form>

</body>

</html>

That was the HTML file. The form asks for you_are_mighty.php, so here
it is:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<?

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];

?>
<meta http-equiv="refresh" content="5;URL=http://<? echo "$firstname";
?>.<? echo "$lastname"; ?>.youaremighty.com">

<title>Christ Warriors Online - Stuff - You Are Mighty</title>
<link rel="stylesheet" type="text/css" href="../styles/default.css">
</head>

<body>

<p>Processing information...</p>

</body>

</html>

The outcome is always that it will meta refresh to
http://..youaremight.com/, skipping over the echos that I placed. Maybe
it's a simple semicolon problem I overlooked, or its something major
when defining the variables. Help needed. Thanks!
  Reply With Quote


  sponsored links


2 11th June 09:25
the numerator
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


I just learned from a previous topic that I have to use the PHP
function header(), but how?
  Reply With Quote
3 11th June 09:25
fiziwig
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


You have:

<form action="you_are_mighty.php" name="mighty">
....
First Name: <input name="firstname" class="input" type="text"
size="20"><p>

There is no such parameter as "name=" in the <form...> tag so that does
nothing.
You did not specifiy method, so it defaults to "get" not "post", so
your variables are never set.

There is no such parameter as "class=" in the <input...> tag so that
does nothing.

Try:

<form action="you_are_mighty.php" method="post">
....
First Name: <input type="text" name="firstname" size="20"><p>

--gary
  Reply With Quote
4 11th June 09:25
fiziwig
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


You don't have to use the header() function. It would work, but what
you have is fine as long as you correct the errors in your form entries
so that your variables are actually getting set.

--gary
  Reply With Quote
5 11th June 09:25
the numerator
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


The "class=input" atribute for the input is for CSS.
  Reply With Quote
6 11th June 09:25
the numerator
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


How could I forget! I forgot to specify the method. Thanks, though I
don't think it will work.
  Reply With Quote
7 11th June 09:25
fiziwig
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


Correction: The "class" attribute can be placed in the <form...> tag,
but it refers back to a div class defined in the cascading style sheet,
and I didn't see any reference to style sheets so I assumed that using
class in the <form...> tag was an error. Of course, if you are using a
style sheet, I stand corrected. But hte other errors will cause you to
not get any data in the $_POST array.

--gary
  Reply With Quote
8 11th June 09:56
the numerator
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


Thanks! I got it working. It was the problem with the method that I
forgot to put in the HTML form. Thank you!
  Reply With Quote
9 11th June 09:56
d
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


Using meta-refresh is not the best way of doing things. header() or
javascript are the best options, as they have guaranteed support for this
  Reply With Quote
10 11th June 10:25
arjen
External User
 
Posts: 1
Default NEWBIE: Meta Refresh Problem


Javascript is *not* the best option. In fact, it's one of the worst
options. Why rely on something that can de client side disabled ?

Just use the header("Location: mysite.cow") or mod_rewrite to redirect
browsers

Arjen
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666