notice melding (Opgelost)
rikske - 03/03/2007 15:46 (laatste wijziging 03/03/2007 15:47)
Nieuw lid
hallo,
ik heb een script geinstallerd om adressen bij te houden, nu ik krijg onderstaande notice (ben geen php spec)
Notice: Undefined variable: submit in c:\program files\easyphp1-8\www\adresboek00\edit.php on line 8
Notice: Undefined variable: update in c:\program files\easyphp1-8\www\adresboek00\edit.php on line 15
Notice: Undefined variable: id in c:\program files\easyphp1-8\www\adresboek00\edit.php on line 21
waaraan ligt dit?
18 antwoorden
Gesponsorde links
Stijn - 03/03/2007 16:17
PHP expert
<?
error_reporting( E_ALL ^ E_NOTICE );
?>
welke notice error?
rikske - 03/03/2007 17:01 (laatste wijziging 03/03/2007 17:44)
Nieuw lid
<?
include ("header.inc.php");
?>
<h1>Edit / add address book entry</h1>
<?php
include("dbconnect.php");
if($submit)
{
$sql = "INSERT INTO $table (firstname, lastname, address, home, mobile, work, email, email2, bday, bmonth, byear) VALUES ('$firstname','$lastname','$address','$home','$mobile','$work','$email','$email2','$bday','$bmonth','$byear')";
$result = mysql_query($sql);
echo "<br><br>Information entered into address book.\n";
}
else if($update)
{
$sql = "UPDATE $table SET firstname='$firstname',lastname='$lastname',address='$address',home='$home',mobile='$mobile',work='$work',email='$email',email2='$email2',bday='$bday',bmonth='$bmonth',byear='$byear' WHERE id=$id";
$result = mysql_query($sql);
echo "<br><br>Address book updated.\n";
}
else if($id)
{
$result = mysql_query("SELECT * FROM $table WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="edit.php">
<?
include ( "header.inc.php" ) ;
?>
<h1>Edit / add address book entry</h1>
<?php
include ( "dbconnect.php" ) ;
if ( $submit )
{
$sql = "INSERT INTO $table (firstname, lastname, address, home, mobile, work, email, email2, bday, bmonth, byear) VALUES ('$firstname ','$lastname ','$address ','$home ','$mobile ','$work ','$email ','$email2 ','$bday ','$bmonth ','$byear ')" ;
echo "<br><br>Information entered into address book.\n " ; }
else if ( $update )
{
$sql = "UPDATE $table SET firstname='$firstname ',lastname='$lastname ',address='$address ',home='$home ',mobile='$mobile ',work='$work ',email='$email ',email2='$email2 ',bday='$bday ',bmonth='$bmonth ',byear='$byear ' WHERE id=$id " ;
echo "<br><br>Address book updated.\n " ; }
else if ( $id )
{
$result = mysql_query ( "SELECT * FROM $table WHERE id=$id " , $db ) ; ?>
<form method="post" action="edit.php">
Citaat:
Rens edit :
Codetags gebruiken!
compudoc - 03/03/2007 17:06 (laatste wijziging 03/03/2007 17:07)
PHP beginner
bijvoorbeeld regel 8, wat is $submit
je moet eerst zeggen: $submit = $_POST['submit'];
en dan bij de rest ook
rikske - 03/03/2007 17:07
Nieuw lid
waar kan ik het volledig script plaatsen?
compudoc - 03/03/2007 17:08
PHP beginner
op plaatscode.be (laatste icoontje in het typvakje bij reactie)
rikske - 03/03/2007 17:53
Nieuw lid
kan je mijn code op http://plaatscode.be/4475 / eens in deze zin aanpassen want ik ben volledig in de mist nu. Sorry hoor
compudoc - 03/03/2007 18:05
PHP beginner
hij bedoelt gewoon dat je ipv $submit, $_POST['submit'] moet gebruiken
rikske - 03/03/2007 18:09
Nieuw lid
nu krijg ik een parse error
Parse error: parse error, expecting `'('' in c:\program files\easyphp1-8\www\adresboek00\edit.php on line 8
rikske - 03/03/2007 18:11 (laatste wijziging 03/03/2007 18:12)
Nieuw lid
<?
include ("header.inc.php");
?>
<h1>Edit / add address book entry</h1>
<?php
include("dbconnect.php");
if $_POST['submit']
{
$sql = "INSERT INTO $table (firstname, lastname, address, home, mobile, work, email, email2, bday, bmonth, byear) VALUES ('$firstname','$lastname','$address','$home','$mobile','$work','$email','$email2','$bday','$bmonth','$byear')";
$result = mysql_query($sql);
echo "<br><br>Information entered into address book.\n";
}
else if($update)
{
$sql = "UPDATE $table SET firstname='$firstname',lastname='$lastname',address='$address',home='$home',mobile='$mobile',work='$work',email='$email',email2='$email2',bday='$bday',bmonth='$bmonth',byear='$byear' WHERE id=$id";
$result = mysql_query($sql);
echo "<br><br>Address book updated.\n";
}
else if($id)
{
$result = mysql_query("SELECT * FROM $table WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="edit.php">
<?
include ( "header.inc.php" ) ;
?>
<h1>Edit / add address book entry</h1>
<?php
include ( "dbconnect.php" ) ;
if $_POST [ 'submit' ]
{
$sql = "INSERT INTO $table (firstname, lastname, address, home, mobile, work, email, email2, bday, bmonth, byear) VALUES ('$firstname ','$lastname ','$address ','$home ','$mobile ','$work ','$email ','$email2 ','$bday ','$bmonth ','$byear ')" ;
echo "<br><br>Information entered into address book.\n " ; }
else if ( $update )
{
$sql = "UPDATE $table SET firstname='$firstname ',lastname='$lastname ',address='$address ',home='$home ',mobile='$mobile ',work='$work ',email='$email ',email2='$email2 ',bday='$bday ',bmonth='$bmonth ',byear='$byear ' WHERE id=$id " ;
echo "<br><br>Address book updated.\n " ; }
else if ( $id )
{
$result = mysql_query ( "SELECT * FROM $table WHERE id=$id " , $db ) ; ?>
<form method="post" action="edit.php">
Citaat:
Rens edit :
Codetags!!!
compudoc - 03/03/2007 18:12 (laatste wijziging 03/03/2007 18:12)
PHP beginner
wat heb je er dan van gemaakt?
zo:
<?php
if($_POST['submit']) {
}
?>
<?php
if ( $_POST [ 'submit' ] ) {
}
?>
[edit] je had al het scriptje erbij gezet
rikske - 03/03/2007 18:13
Nieuw lid
ja
Stijn - 03/03/2007 18:15
PHP expert
http://plaatscode.be/4476 / -> dit zou nu geen notice meer mogen opgeven en kijk er eens naartoe en leer bij. Je ziet dat alle variablen buiten quotes staan ook. Dat moet zo!
rikske - 03/03/2007 19:16
Nieuw lid
bedankt hoor
Gesponsorde links
Dit onderwerp is gesloten .