PDA

View Full Version : php



ghola1364
سه شنبه 28 اسفند 1386, 14:20 عصر
سلام من یک صفحه ثبت نام درست کردم هم چی درست بود ولی دو مشکل برام پیش امد
1 وقتی اطلاعات sendمیشد توی جدول دیتابیس فیلد خالی نشان می داد
2 الان هم که ارسال نمی شه و توی دستور if خطا داره چه input هام پر باشه چه نباشه errorخالی بودن میده اینم کد:
<?php
$link = mysql_connect("localhost","root","") or die('error');
$link=mysql_select_db("usermaryam", $link);
//Check for send button clicked ...
if($username == '')
{
' <script>alert("Please enter Your username.")history.back(-1);</script> ';
}
if($password == '')
{
' <script>alert("The mail password is empty ! please enter it.")history.back(-1);</script> ';
}
if($Email == '')
{
' <script>alert("The mail email is empty ! please enter it.")history.back(-1);</script> ';
}

else
echo ("Thank you! .");
$query="INSERT INTO 'u1' ( 'username' , 'password' , 'email' )
VALUES ('$_POST[Username]', '$_POST[Password]', '$_POST[Email]')";
$result=mysql_query($query);
if($result)
{
echo '<font size=7><b>ok insert</b></font>';

}
?>

Bahram0110
سه شنبه 28 اسفند 1386, 14:56 عصر
else
{
echo ("Thank you! .");
$query="INSERT INTO 'u1' ( 'username' , 'password' , 'email' )
VALUES ('$_POST[Username]', '$_POST[Password]', '$_POST[email]')";
$result=mysql_query($query);
if($result)
{
echo '<font size=7><b>ok insert</b></font>';
}
}
بعد از if ، { بذار...

Bahram0110
سه شنبه 28 اسفند 1386, 15:04 عصر
ببخشید!
کدت کامل اشکال داره
اینو امتحان کن



<?php
$link = mysql_connect("localhost","root","") or die('error');
$link=mysql_select_db("usermaryam", $link);
//Check for send button clicked ...
$error = 0;
if($username == '')
{
echo ' <script>alert("Please enter Your username.")history.back(-1);</script> ';
$error = 1;
}
if($password == '')
{
echo ' <script>alert("The mail password is empty ! please enter it.")history.back(-1);</script> ';
$error = 1;
}
if($Email == '')
{
echo ' <script>alert("The mail email is empty ! please enter it.")history.back(-1);</script> ';
$error = 1;
}
if ($error == 0)
{
echo ("Thank you! .");
$query="INSERT INTO 'u1' ( 'username' , 'password' , 'email' )
VALUES ('$_POST[Username]', '$_POST[Password]', '$_POST[email]')";
$result=mysql_query($query);
if($result)
{
echo '<font size=7><b>ok insert</b></font>';
}
}
?>

ghola1364
چهارشنبه 14 فروردین 1387, 08:14 صبح
سلام ممنون از راهنمایتون
سال نو هم مبارک و سال خوب وخوش داشته باشید
درباره کد بالا باز هم هیچ فیلدی در دیتابیس درست نمی کند من باید چه کار کنم میشه دوباره منو راهنمایی کنید از کمک شما ممنون

amirhosein
چهارشنبه 14 فروردین 1387, 09:46 صبح
به جای 'u1' بذارید u1 و امتحان کنید.
در ضمن کد صفحه ارسال کننده را هم بگذارید.

ghola1364
چهارشنبه 14 فروردین 1387, 10:49 صبح
سلام ببخشید کد صفحه رو نمی تونم بذارم لطفا بگین به چه صورت کل کد را در اینجا قرار بدم ممنون

amirhosein
چهارشنبه 14 فروردین 1387, 11:34 صبح
توی ویرایشگری که متن رو می نویسید یه دکمه با این تصویر هست: # اون رو بزنید و کدها رو بین تگهای اون قرار بدین.

ghola1364
چهارشنبه 14 فروردین 1387, 12:04 عصر
[CODE]

<?php
session_start();if(isset($_SESSION['Pageviews'])) $_SESSION['Pageviews']=$_SESSION['Pageviews']+1;
else $_SESSION['Pageviews']=1;echo "Page views=". $_SESSION['Pageviews'];
?>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="

ghola1364
چهارشنبه 14 فروردین 1387, 12:05 عصر
چرا نصف میاد؟؟؟؟

ghola1364
چهارشنبه 14 فروردین 1387, 12:06 عصر
چرا نصف میاد؟؟؟؟ کد کامل نشان نمیده

ghola1364
چهارشنبه 14 فروردین 1387, 13:06 عصر
<body background="orviss.jpg">
<table cellspacing="0" cellpadding="0" width="909">
<tr>
<td id="page" width="906" height="101" colspan="2">
<div align=center>
<div id="bpage">
<div id="title-center">
<div id="title-left">
<div id="title-right" style="width: 718px; height: 91px">
<div id=blogtitle>
<h1 id="head1"><font size="5" color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></h1></div>
<div align="left">
&nbsp;</div>
</div>
</div></div></div>
<BlogAuthorsBlock>
<BlogLinkDumpBlock>
<tr>
<td height="492" width="159">
<font face="Lucida Han..." size="3pt" color="#000000">
<div id="pm-left1">
<div id="pm-right1">
<div id="pmtitle1">
<p align="left">
<font size="2"><font size="2" face="Lucida Han..." color="#000000"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORJINALMENU&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b></font></div>
</div></div></BlogProfile>
<p align="left"><font color="#000000">&nbsp;</font><span style="font-size: 9pt"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </b></span>
<font size="2" face="Lucida Han..." color="#000000"><a href="java1.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#000000"><img border="0" src="51.png" width="12" height="13"></font></a></font><span style="font-size: 9pt"><b><a href="java1.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font color="#383838">HOME</font></a><font color="#383838">
</font>
<a href="java1.php" style="color: "#383838"; font-family: Tahoma; font-size: 8pt; text-decoration: none">
<font color="#383838">&nbsp; </font> </a>
<font color="#383838">&nbsp; </font> </b></span><font color="#383838"><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</font><font color="#000000" size="2" face="Lucida Han..."><a href="matlab1.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#000000"><img border="0" src="51.png" width="12" height="13"></font></a></font></font></font><font color="#000000"><b><a href="" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font size="3pt" style="font-size: 8pt" color="#383838" face="Tahoma">List
personnel</font></a></b></font><font size="2" face="Lucida Han..." color="#383838"><font color="#383838">&nbsp;&nbsp;&nbsp;&nbsp;
</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="send1.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#000000"><img border="0" src="51.png" width="12" height="13"></font></a></font></font><font size="2" face="Lucida Han..." color="#000000"><span style="font-size: 9pt"><b><a href="send1.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#383838">E_mail</font></a></b></span></font><font size="2" face="Lucida Han..." color="#383838">&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="2" face="Lucida Han..." color="#000000"><font color="#000000"> <br>
<script>function mo_save () {window.document.execCommand('SaveAs')}</script>
</font>
<span style="font-size: 9pt"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </b></span><font color="#000000"><a href="javascript:mo_save()" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#ffffff"><img border="0" src="51.png" width="12" height="13"></font></a></font></font><font face="Lucida Han..." size="3pt" color="#000000"><font size="2"><span style="font-size: 9pt"><b><a href="javascript:mo_save()" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font color="#383838">To
Save Page</font></a></b></span><font color="#000000"><a href="javascript:mo_save()" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#383838">&nbsp;</font></a></font></font></font><font size="2"><font face="Lucida Han..." size="3pt" color="#383838">&nbsp;&nbsp;&nbsp;&nbsp; </font><font face="Lucida Han..." size="3pt" color="#000000"><br><BlogProfile></BlogProfile><BlogProfile></BlogProfile>
</font>
</font> <font face="Lucida Han..." size="3pt" color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img border="0" src="51.png" width="12" height="13"></font><BlogProfile></BlogProfile><BlogProfile></BlogProfile><b><font size="2"><a href="register.php" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font color="#383838">RegisterName&nbsp;</font></a></font></b><font face="Lucida Han..." size="3pt" color="#000000">&nbsp; </font><font color="#000000">&nbsp; </font>

<BlogProfile><div id="pm-left2">
<div id="pm-right2">
<div id="pmtitle2">
</BlogProfile>
<p align="left"><font size="2"><font size="2" face="Lucida Han..." color="#000000"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINKS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</b></font></div>
</div></div></div>

<p align="left">

<span style="font-weight: 700; font-size: 9pt">&nbsp;</span><font color="#000000" size="2" face="Lucida Han..."><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><a href="http://arminaey.mihanblog.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#000000"><img border="0" src="51.png" width="12" height="13" ></font></a></font><span style="font-weight: 700; font-size: 9pt"><a href="http://arminaey.mihanblog.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font color="#383838">T</font><span style="font-size: 9pt"><font color="#383838">he Best Links</font></span></a></span><font color="#383838">&nbsp;&nbsp;&nbsp;&nbsp; <br>
<span style="font-weight: 700; font-size: 9pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span></font><font color="#000000" size="2" face="Lucida Han..."><a href="http://www.kookmagazine.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#383838"><img border="0" src="51.png" width="12" height="13"></font></a></font><span style="font-weight: 700; font-size: 9pt"><a href="http://www.kookmagazine.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none"><font color="#383838">K</font><span style="font-size: 9pt"><font color="#383838">ook</font></span></a></span><font color="#000000"><a href="http://www.kookmagazine.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#383838">&nbsp;&nbsp;&nbsp;&nbsp; </font></a><br>
<a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" >
&nbsp;</a></font><font color="#000000" size="2" face="Lucida Han..."><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><font color="#000000"><img border="0" src="51.png" width="12" height="13"></font></font><font color="#000000"><a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" ><span style="font-size: 9pt"><b><font color="#383838">Pictures</font></b></span><font color="#383838"> </font><font color="#000000">&nbsp;&nbsp;&nbsp; </font></font>
<a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" >
<p align="left">

</a></font></font><font size="3pt" color="#000000">
</font></font>

<p align="left"></div>
</div></div></div>
<td align="right" width="750">
<table border="0" width="75%" cellspacing="0" cellpadding="0" id="table6">
<tr>
<td width="73%" height="496">
<form name="username" action="mail41.php" method="post">

<TABLE dir="ltr" cellSpacing="0" cellPadding="0" width="750" align="center" border="0">
<TR>
<TD>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR >
<td ></td>
<TD dir="rtl" align="center" width="749">&nbsp;<p>&nbsp;</p>
<p>
<b><font face="Californian FB" color="#CC0000">
Register Name </font>
</b>
<table id="tblStep1" dir="rtl" cellspacing="0" cellpadding="0" width="529" border="0">
<tr>
<TD dir="rtl" align="center">
<table height="100%" cellSpacing="0" cellPadding="0" width="95%" border="0">
<tr>
<td class="tit" dir="rtl" vAlign="bottom" height="25">
<table style="width: 100%" cellspacing="0" cellpadding="0">
<tr>
<td class="tit" style="width: 159px">
<font size="2" color="#FFFFFF">
شناسه کاربری
</font>
<font face="Californian FB" color="#CC0000">
<font size="2">
(Username)</font>:</font></td>
<td><b>
<span id="Err1" dir="rtl" style="color:Red;font-family:Tahoma;font-size:XX-Small;"></span></b>
</td>
</tr>
</table>
</td>
</tr> <tr>
<td dir="rtl" height="5">
<font size="2" color="#FFFFFF">
(این شناسه برای
دیگران قابل رویت
نمیباشد)
</font></td>
</tr>
<tr>
<td dir="rtl" vAlign="bottom" height="25">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="260"><input name="username" type="text" maxlength="256"dir="ltr" AutoComplete="off" onChange="changeid()" /></td>
<td dir="ltr" align="left" width="10">&nbsp;
</td>
<td dir="rtl">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td dir="rtl" vAlign="bottom" height="10"><a class="bluered8" id="idAnchor" href="javascript:openCh('IDHelper.aspx?vc=','')">
آ<span style="font-size: 9pt">یا
این شناسه قبلا&quot;
انتخاب شده؟</span></a></td>
</tr>
<tr>
<td class="tit" dir="rtl" vAlign="bottom" height="30"><font size="2">
<font color="#FFFFFF">
کلمه عبور
</font>
<font size="2" face="Californian FB" color="#CC0000"> <span lang="en-us">
(Password):</span></font></td>
</tr>
<tr>
<td dir="rtl" height="30">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="260"><input name="password" type="password"dir="ltr" AutoComplete="off" onChange="changeid()"/></td>

<td dir="rtl">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="tit" dir="rtl" vAlign="bottom" height="20"><font size="2">
<font color="#FFFFFF">
تکرار کلمه عبور</font><font size="2" face="Californian FB" color="#CC0000">(Repeat
Password):</font></td>
</tr>
<tr>
<td dir="rtl" height="30">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="260"><input name="password_v" type="password" id="password_v" class="input_shadow_8" dir="ltr" /></td>

<td dir="rtl">
<span id="Requiredfieldvalidator4" dir="rtl" controltovalidate="password_v" errormessage="*" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" style="color:Red;font-family:Tahoma;font-size:6pt;visibility:hidden">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="gray8" dir="rtl" vAlign="top" height="10">
<font color="#FFFFFF">
<span style="font-size: 9pt">
(حداقل از 6 کاراکتر
استفاده کنید)</span></font></td>
</tr>
<tr>
<td class="gray8" dir="rtl" vAlign="bottom" align="right" height="50">
<table cellSpacing="0" cellPadding="0" border="0" width="313">
<tr>
<td width="87">
<font color="#FFFFFF" face="Lucida Han..." size="2">
Special&nbsp;
E_mail:</font></td>
<td class="tit">
<p align="right">
<font color="#FFFFFF">
&nbsp;
</font> <b>
<font color="#FFFFFF">
<span lang="en-us">
&nbsp;</span></font></b><font color="#FFFFFF" face="Lucida Han..." size="3pt"><input name="Email" type="text" maxlength="256" dir="ltr"AutoComplete="off" onChange="changeid()" /></font><span id="Err2" dir="rtl" style="color:Red;font-family:Tahoma;font-size:XX-Small;"></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="gray8" dir="rtl" height="5">
<font color="#FFFFFF">
<span style="font-size: 8pt">
(ایمیل تایید اولیه
برای فعال نمودن حساب
کاربری شما در سایت،
به این آدرس ارسال
خواهد شد)</span></font></td>
</tr>
<tr>
<td class="gray8" dir="rtl" height="30">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="260"></td>

<td dir="rtl">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="tit" dir="rtl" vAlign="bottom" height="25">
<font color="#FFFFFF">
FirstName :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1" face="Lucida Han..." color="#000000"><input name="FirstName" type="text" maxlength="256" id="FirstName" class="input_shadow_8" lang="f"onkeypress="FKeyPress()" dir="rtl" /></font></td>
</tr>
<tr>
<td dir="rtl" align="right" height="30">
<table cellSpacing="0" cellPadding="0" border="0" width="269">
<tr>
<td width="260">&nbsp;</td>
<td dir="ltr" align="center" width="9">&nbsp;
</td>


</table>
</td>
</tr>
<tr>
<td class="tit" dir="rtl" vAlign="bottom" height="20">
<font color="#FFFFFF">
LastName:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</font><font size="1" face="Lucida Han..." color="#000000"><input name="LastName" type="text" maxlength="256" id="LastName" class="input_shadow_8" lang="f" onKeyPress="FKeyPress()" dir="rtl" /></font><font color="#FFFFFF">&nbsp;&nbsp;
</font>

<font color="#000000" size="2" face="Lucida Han...">
<a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" >
<font face="Lucida Han..." size="3pt" color="#000000">

<input type="submit" name="send" value="ارسال" ></b></td>
</tr>
</table></form>

<tr>
<td dir="rtl" align="right" height="30">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="260">&nbsp;

</td>
<td dir="ltr" align="center" width="24">&nbsp;
</td>

<td dir="rtl"><table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td>
</td>

<table height="114%" cellSpacing="0" cellPadding="0" width="104" border="0">
<tr>
<td dir="ltr" align="center" height="36">

&nbsp;
</b></td>
</tr>






</TD>
</TR>
</td>
<div id="pmtitle1">
<p align="left"></div>
</div></div><font size="3pt" color="#000000">
<p align="right">&nbsp;</font>&nbsp;&nbsp; </p><font size="2">

<p align="right">

<font color="#000000">
<a href="http://www.persiangraphic.com/" style="color: #FFFFFF; font-family: Tahoma; font-size: 8pt; text-decoration: none" >
<font color="#000000"></div>
&nbsp; </font>
<tr>
<td width="906" colspan="2">
<font face="Lucida Han..." size="3pt" color="#000000">
<p align="right">&nbsp;</p>
<table border="0" width="75%" cellspacing="0" cellpadding="0" id="table6" height="19">
<tr>
<td width="99%" height="19">&nbsp;
</td>
</tr>
</td>
</tr>

</tr>
</table>
</body>
</html>

ghola1364
چهارشنبه 14 فروردین 1387, 13:54 عصر
کسی جواب نمی ده ؟؟؟؟؟؟؟؟؟؟؟

musiox
پنج شنبه 15 فروردین 1387, 18:30 عصر
username ,.... مقدار ندارن. بعدم ببین mysql خطا داره یا نه .