Want to add checkbox for Terms & Conditions at the bottom of an account_create_page that (i'm told) is submitting to index.php
Can someone provide with the code to plug-in, please?
thanks
Want to add checkbox for Terms & Conditions at the bottom of an account_create_page that (i'm told) is submitting to index.php
Can someone provide with the code to plug-in, please?
thanks
not sure what your asking but you can you can either handle the checkbox requirement in javascript, php, or both
it can be as simple as inserting this into your form
<input type="checkbox" name="terms" value="true">
and in the PHP doing
if (!isset($_POST["terms"))
{
//do what you want if they didnt check, either header them back or echo an error
header("Location: form_url.php");
}
else
{
///excecute form proccessing
}
Thanks SO much for that help. I greatly appreciate it.
However, I have a couple of questions if you don't mind.
I've added the code you provided to the account_create_page, below, at the bottom of the page, but it doesn't look correct on the page. The "I Have Read The Terms & Conditions" wraps instead of stays in a stright line. It may be because of
<td class='fieldLabel'>, which I just copied from the fields above it. What is the correct way to show this on the page, please?
Also, could you please help me with where "in the PHP" you suggest I add:
if (!isset($_POST["terms"))
{
//do what you want if they didnt check, either header them back or echo an error
header("Location: form_url.php");
}
else
{
///excecute form proccessing
}
Thank you.
<?php global $account; ?>
<table cellpadding="0" width="770" height="100%" cellspacing="0" bgcolor="#FFFFFF">
<form method="POST" action="index.php">
<tr>
<td width="145" rowspan="21" id="menu"> </td>
<td> </td></tr>
<input class='field' type='hidden' name='command' value='account'>
<input class='field' type='hidden' name='param' value='signup'>
<tr>
<td class='pageTitle'><span class="hLine"> <font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Create New Account</span></td>
<td class='pageTitle'> </td>
</tr>
<tr>
<td class='fieldLabel' width="30%"><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Membership Type</td>
<td align="center">[account_type_panel]</td></tr>
<tr>
<td class='fieldLabel' width="30%"><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> User Name</td>
<td><input class='field' type='text' size='30' maxlength="30" name='user_name' value='<?=$account->user_name ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('user_name') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Password</td>
<td><input class='field' type='password' size='30' maxlength="30" name='password' value='<?=$account->password ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('password') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Re-Enter Password</td>
<td><input class='field' type='password' size='30' maxlength="30" name='reenter_password' value='<?=$account->reenter_password ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('reenter_password') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> First Name </td>
<td ><input class='field' type='text' size='40' maxlength="50" name='first_name' value='<?=$account->first_name ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('first_name') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Last Name</td>
<td><input class='field' type='text' size='40' maxlength="50" name='last_name' value='<?=$account->last_name ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('last_name') ?></span></td>
</tr>
<tr>
<td> </td></tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Email Address</td>
<td><input class='field' type='text' size='40' maxlength="50" name='email' value='<?=$account->email ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('email') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Address</td>
<td><input class='field' type='text' size='40' maxlength="70" name='address' value='<?=$account->address ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('address') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Address 2</td>
<td><input class='field' type='text' size='40' maxlength="70" name='address_second' value='<?=$account->address_second ?>'></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> City</td>
<td><input class='field' type='text' size='40' maxlength="50" name='city' value='<?=$account->city ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('city') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> State/Province</td>
<td><input class='field' type='text' size='35' maxlength="35" name='phone' value='<?=$account->phone ?>'><span class='requiredField'> * </span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Zip/Postal Code</td>
<td><input class='field' type='text' size='35' maxlength="35" name='zip_postal_code' value='<?=$account->zip_code ?>'>
<span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('zip_code') ?></span></td>
</tr>
<tr>
<td class='fieldLabel'><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> Country</td>
<td><input class='field' type='text' size='35' maxlength="35" name='mobile_phone_number' value='<?=$account->mobile_phone_number ?>'> <span class='requiredField'> * </span></td>
</tr>
<tr>
<td class='fieldLabel'> <font face="Arial" color=#000000" size="3" Style="padding: 5px;"> I Have Read The Terms & Conditions</td><td><input type="checkbox" name="terms" value="true"><span class='requiredField'> * </span></td>
</tr>
<tr>
<td>
</td></tr>
<tr>
<td> </td></tr>
<tr><td class='hLine' align="right"> </td>
<td class='hLine' align="right"> <span class='requiredField'> * </span><font color="red"> Required field </font></span></td>
</tr>
<tr><td align="right"> </td>
<td align="right"><input name="submit" type='submit' class='button' value='create' /> </td>
</tr>
<tr><td> </td>
<td> </td>
</tr>
</form>
</table>
Hello Chris
Well, a couple of things
First, the text wraps because it's in a table column and it simpy ran out of space. Open up your table columns however you like and it should fix the text wrap.
your form is sending the the post information to index.php, so index.php is actually responcible for processing the form.
The next thing is really what do you want to do with this information?
Are you storing it in a DB or emailing it somewhere or both?
so the code I gave you for PHP you would place in index.php (probably at the top) and add the addtional code to either email or insert the info into a db.
If you need help with form processing, there are a couple of tutorials here, and great documentation on mail() . check out www.php.net for references, read up on mail()
also, how familiar are you with mysql or postgreSQL I take if if you are new to PHP you probably got exposed to MySQL if any type of database