Reputation: 45
This is my code.. The problem is that the code after the '>' in if(mysql_affected_rows()>0) id displayed as plain text in the webpage.. Please help..
<?php
session_start();
if( isset( $_POST[reg] ) )
{
$name = $_POST[n1];
$age = $_POST[a1];
$gen = $_POST[r1];
$phno = $_POST[phno1];
$email = $_POST[email1];
$pin = $_POST[pin1];
$user = $_POST[u1];
$pas = $_POST[pass];
$pas1 = $_POST[pass1];
$i = $_POST[i1];
include( "connect.php" );
$q = "INSERT INTO reg VALUES('0', '$name', '$age', '$gen', '$phno', '$email', '$pin', '$user', '$pas')";
mysql_query( $q ) or die( mysql_error() );
if(mysql_affected_rows()>0)
{
header("location:index.php");
}
}
?>
Upvotes: 0
Views: 871
Reputation: 2180
It sounds like your PHP code is not being interpreted at all. If you look at the source code via the browser, do you see a <?php
tag in there? This should not happen. If this is the case, your PHP code is not being recognized.
For example, looking at the source in Firefox, if you see something like this, something is wrong with how PHP is executed: image of PHP code that isn't executed
Any <?php
tag that can be seen in the browser's source code is a problem.
By the way, be sure to put strings into quotes. You are using things like $_POST[u1]
where it should be $_POST["u1"]
or $_POST['u1']
. Only constants should be used without quotes.
Upvotes: 4