PDA

View Full Version : beginner need help with php



pixeldude
April 6th, 2005, 07:10 AM
Ello everyone...i just need help with my code i think...
I have 2 page..one for applyform and another form to inform that dt has been saved. so when it save in dtbase it'll show the confirm page the problem is when it show confirm page it seems something wrong with the page is it my code are totally wrong....

the action from 1st form goes to confirm.php

and this is my code in confirm.php



<? if($_POST['Submit']){
$username=$_POST['username'];
$password=$_POST['password'];
$confirmp=$_POST['confirmp'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$icno=$_POST['icno'];
$g=$_POST['g'];
$r=$_POST['r'];
$add1=$_POST['add1'];
$add2=$_POST['add2'];
$add3=$_POST['add3'];
$uzip=$_POST['uzip'];
$ustate=$_POST['ustate'];
$telh=$_POST['telh'];
$telp=$_POST['telp'];
$telo=$_POST['telo'];
$telf=$_POST['telf'];
$p=$_POST['p'];
$padd1=$_POST['padd1'];
$padd2=$_POST['padd2'];
$padd3=$_POST['padd3'];
$pzip=$_POST['pzip'];
$pstate=$_POST['pstate'];
$amount=$_POST['amount'];
$link = mysql_connect ("localhost","","") or die('Could not connect: ' . mysql_error());
mysql_select_db("eprop");
$query = "INSERT INTO notpay SET username='$username', password='$password', confirmp='$confirmp', fname='$fname', lname='$lname',
icno='$icno',
g='$g',
r='$r',
add1='$add1',
add2='$add2',
add3='$add3',
uzip='$uzip',
ustate='$ustate',
telh='$telh',
telp='$telp',
telo='$telo',
telf='$telf',
p='$p',
padd1='$padd1',
padd2='$padd2',
padd3='$padd3',
pzip='$pzip',
pstate='$pstate',
amount='$amount' "; $loginstuff = mysql_query($query) or die(mysql_error()); mysql_close($link);
}//end submit ?>


so at the center of the page i just to inform the user that ur dt has been save into dtbase and bla.bla..bla..bla...that i just display it's name also with this code name : <? echo $username; ?>btu it's seem nothing display alsoonly show name:

so is it my code are wrong....really need help with it...

SlowRoasted
April 6th, 2005, 11:57 AM
= mysql_query($query)

your not setting anything to mysql_query. You have to assign it to a variable

your error message would help too

Lukus
April 6th, 2005, 08:15 PM
yer, you've said "$query = [the query you did] = mysql_query..." ... cant do that :)

$query = [the query]
$result = mysql_query($query)

:)

Cybernoid
April 7th, 2005, 09:42 AM
Actually the code is right, just scroll right:



$query = "INSERT INTO blah blah amount='$amount'";
$loginstuff = mysql_query($query) or die(mysql_error());
mysql_close($link);



But I would suggest fixing the linebreaks like I did above. It just might be that the server doesn't understand the code with funky line breaks.

SlowRoasted
April 7th, 2005, 11:20 AM
o lol, didnt see that over there haha

yeah, try formatting your code in a nice way.