Jump to content
  • 0

помогите, не могу сделать пошаговую регистрацию


make.kz
 Share

Question

Ребята срочно нужна Ваша помощь, так как мой мозг уже отказывается думать.

Делаю пошаговую регистрацию на смарти.

Итак signup.tpl


{include file='header.tpl'}

<div id="container">
<table cellpadding="0" cellspacing="0" width="1000" align="center">
<tr>
<td>
{if !$signup_free}

{else}
{if $step==1}
{if $is_error != 0}
<table cellpadding='0' cellspacing='0' align="center">
<tr><td class='result'>
<div class='error'><strong style="color:red;">{lang_print id=$is_error}</strong></div>
</td></tr></table>
<br>
{/if}
<form action="signup.php?signup_free=1" method="post">
<input type='hidden' name='next_step' value='{$next_step}'>
<input type='hidden' name='step' value='{$step}'>
<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="left">
<p>{lang_print id=1}</p>
</td>
<td>
<p><input type="text" name="username" value="{$username}"/></p>
</td>
</tr>
<tr>
<td align="left">
<p>{lang_print id=4}</p>
</td>
<td>
<p><input type="text" name="user_email" value="{$user_email}"/></p>
</td>
</tr>
<tr>
<td align="left">
<p>{lang_print id=5}</p>
</td>
<td>
<p><input type="password" name="user_password" value="{$user_password}"/></p>
</td>
</tr>
<tr>
<td align="left">
<p>{lang_print id=6}</p>
</td>
<td>
<p><input type="password" name="user_password2" value="{$user_password2}"/></p>
</td>
</tr>
<tr>
<td align="left">
<p>{lang_print id=9}</p>
</td>
<td>
<p><select name="reg_type">
<option value="0">{lang_print id=9}</option>
{section name=items_loop loop=$items}
<option value="{$items[items_loop].id}" {if $items[items_loop].id==$reg_type}selected='selected'{/if}>{lang_print id=$items[items_loop].name}</option>
{/section}
</select></p>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" value="1" name="signup_agree">
<label>
{lang_print id=13}
</label>
</td>
</tr>
<tr>
<td colspan="2">
<p><input type="submit" value="{lang_print id=7}" /></p>
</td>
</tr>
</table>
</form>

{elseif $step==2}
{if $is_error != 0}
<table cellpadding='0' cellspacing='0' align="center">
<tr><td class='result'>
<div class='error'><strong style="color:red;">{lang_print id=$is_error}</strong></div>
</td></tr></table>
<br>
{/if}
<form action="signup.php?signup_free=1" method="post">
<input type='hidden' name='next_step' value='{$next_step}'>
<input type='hidden' name='step' value='{$step}'>
<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="left">
</td>
<td>
Step2
</td>
</tr>
<td colspan="2">
<p><input type="submit" value="{lang_print id=7}" /></p>
</td>
</tr>
</table>
</form>
{elseif $step==3}
{if $is_error != 0}
<table cellpadding='0' cellspacing='0' align="center">
<tr><td class='result'>
<div class='error'><strong style="color:red;">{lang_print id=$is_error}</strong></div>
</td></tr></table>
<br>
{/if}
<form action="signup.php?signup_free=1" method="post">
<input type='hidden' name='next_step' value='{$next_step}'>
<input type='hidden' name='step' value='{$step}'>
<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="left">
</td>
<td>
Step3
</td>
</tr>
<td colspan="2">
<p><input type="submit" value="{lang_print id=7}" /></p>
</td>
</tr>
</table>
</form>
{/if}
{/if}
</td>
</tr>
</table>
</div>

{include file='footer.tpl'}

signup.php


if($step == 1) {
$step = 1;
$next_step = 2;
$entity = mysql_query("SELECT * FROM reg_types");
while($e=mysql_fetch_assoc($entity)){
$items[] = array('id'=>$e['id'], 'name'=>$e['type_name']);
}
$smarty->assign('items', $items);


if($signup_agree != 1) {
$is_error = 12;
}
if(ereg('[^A-Za-z0-9]', $username))
{
$is_error = 14;
}
if($user_password != $user_password2)
{
$is_error = 15;
}
if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $user_email)){
$is_error = 16;
}
if($reg_type<0){
$is_error = 17;
}
if($is_error==0){
$step=2;
}else{
$step=1;
}

}

Ну так вот, у меня не переходит на $step=2;

Это часть кода из php-файла. Просто именно тут ошибка. Хотя никакую ошибку не выдает, все работает, и $_POST[step] выводил, показывает 2, но не переходит на него

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

а ты выведи переменную $step

и $_POST[step]

у меня такое ощущение, что $step у тебя всегда = 1.

И условие $step == 2 просто не выполняется.

По крайней мере я не вижу где $step присваивается значение 2.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy