I looking for alittle help im new at this. I'm getting a error message --> Notice: Undefined variable: submit in e:\apache group\apache\htdocs\create_entry.php on line 12
-----------
sign.php - is the signup page doesn't get me any errors.
----------
<body>
<h2>Sign my Guest Book!!!</h2>
<form method=post action="create_entry.php">
<b>Name:</b>
<input type="text" size="40" name="name">
<br>
<b>Location:</b>
<input type="text" size="40" name="location">
<br>
<b>Email:</b>
<input type="text" size="40" name="email">
<br>
<b>Home Page URL:</b>
<input type="text" size="40" name="url">
<br>
<b>Comments:</b>
<textarea name="comments" cols="40" rows="4" wrap="virtual"></textarea>
<br>
<input name="$submit" type="submit" id="submit" value="submit">
<input type="reset" name="reset" value="Start Over">
</form>
</body>
-----------------------------------------------------------
---------------------
create_entry.php - this is the page giving me the error on line "12"
---------------------
09) <?php
10) include("dbconnect.php");
11)
12) if ($submit == "submit")
13) {
14) $query = "insert into guestbook
15) (name, location, email, url, comments) values
16) ('$name','$location','$email','$url','$comment')";
17) mysql_query($query) or
18) die (mysql_error());
19)
20)?>
21)<h2>Thanks!!</h2>
22)<h2><a href="view.php">View My Guest Book!!!</a></h2>
23)<?php
24)}
25)else
26){
27)include("sign.php");
28)}
29)?>
Notice: Undefined variable: submit in
Moderator: General Moderators
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
try changing the submit == submit line to :
Code: Select all
if (isset($_POST['name'])) {-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
Re: Notice: Undefined variable: submit in
I found the problem. array name was wrong lol
// error
error was here!!! (16) ('$name','$location','$email','$url','$comment')";
// error
//correct- had forgotten the (s)
(16) ('$name','$location','$email','$url','$comments')";
//correct- had forgotten the (s)
// error
error was here!!! (16) ('$name','$location','$email','$url','$comment')";
// error
//correct- had forgotten the (s)
(16) ('$name','$location','$email','$url','$comments')";
//correct- had forgotten the (s)
teamct2k wrote:I looking for alittle help im new at this. I'm getting a error message --> Notice: Undefined variable: submit in e:\apache group\apache\htdocs\create_entry.php on line 12
-----------
sign.php - is the signup page doesn't get me any errors.
----------
<body>
<h2>Sign my Guest Book!!!</h2>
<form method=post action="create_entry.php">
<b>Name:</b>
<input type="text" size="40" name="name">
<br>
<b>Location:</b>
<input type="text" size="40" name="location">
<br>
<b>Email:</b>
<input type="text" size="40" name="email">
<br>
<b>Home Page URL:</b>
<input type="text" size="40" name="url">
<br>
<b>Comments:</b>
<textarea name="comments" cols="40" rows="4" wrap="virtual"></textarea>
<br>
<input name="$submit" type="submit" id="submit" value="submit">
<input type="reset" name="reset" value="Start Over">
</form>
</body>
-----------------------------------------------------------
---------------------
create_entry.php - this is the page giving me the error on line "12"
---------------------
09) <?php
10) include("dbconnect.php");
11)
12) if ($submit == "submit")
13) {
14) $query = "insert into guestbook
15) (name, location, email, url, comments) values
// error
error was here!!! (16) ('$name','$location','$email','$url','$comment')";
// error
17) mysql_query($query) or
18) die (mysql_error());
19)
20)?>
21)<h2>Thanks!!</h2>
22)<h2><a href="view.php">View My Guest Book!!!</a></h2>
23)<?php
24)}
25)else
26){
27)include("sign.php");
28)}
29)?>