Jump to content

Search the Community

Showing results for tags 'function help'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. please i've been trying to create a registration form for my website and it seems like its taking forever..... i've got some error of which i have tried to rectify but to no avail, so decided post the code and the error to see if someone might be of help to me <?php $required=array("fname" => "Firstname", "lname" => "Lastname", "email" => "Email address", "password" => "Password"); foreach ($required as $field => $label) { if (isset($_POST[$field])) { $warnings[$field] = "Required"; } } if (isset($_POST["email"])&& !ereg("^[^@]+@([a-z\-]+\.)+[a-z]{2,4}$", $_POST["email"])) $warnings["email"] = "Invalid email"; if (isset($_POST["telephone"])&& !ereg("^\([[:digit:]]{3}\)[[:digit:]]{4}-[[:digit:]]{4}$", $_POST["telephone"])) $warnings["telephone"] = "Must be (555)0000-0000"; $password=$_POST["password"]; $salt=rand(100000,999999); $encrypted= (md5($salt.$password)); if (empty($warnings) > 0) { ?> <form action = "register.php" method=post> <table border=0> <tr> <td>Firstname:</td> <td><input type=text size=30 name="fname" value="<?php echo (isset($_POST["fname"])? $_POST ["fname"]:"");?>" > </td> <td><?php echo (isset($warnings["fname"])? $warnings["fname"]:"");?> </td> </tr><br/> <tr> <td>Lastname:</td> <td><input type=text size=30 name="lname" value="<?php echo (isset($_POST["lname"])? $_POST ["lname"]:"");?>"> </td> <td><?php echo (isset($warnings["lname"])? $warnings["lname"]:"");?> </td> </tr> <tr> <td>Email address:</td> <td><input type=text size=30 name="email" <?php if (isset($warnings["email"])) echo "STYLE=\"shaded\"";?> value="<?php echo (isset($_POST["email"])? $_POST["email"]:"");?>"> </td> <td><?php echo (isset($warnings["email"])? $warnings["email"]:"");?> </td> </tr> <tr> <td>Password:</td> <td><input type=password size=30 name="password" value="<?php echo (isset($_POST["password"])? $_POST["password"]:"");?>"> </td> <td><?php echo (isset($warnings["password"])? $warnings[password]:"");?> </td> </tr> <tr> <td>Telephone:</td> <td><input type=text size=30 name="telephone" value="<?php echo (isset($_POST["telephone"])? $_POST["telephone"]:"")?>"> </td> <td><?php echo (isset($warning["telephone"])? $warnings["telephone"]:"");?> </td> </tr> <tr> <td>sex:</td> <td><?php include("sex.php"); ?> </td> <td></td> </tr> <tr> <td>Date of birth:</td> <?php $menu = generate_menu("year", $endYear = '', $startYear = '1900'); function generate_menu($name, $endYear = '', $startYear = '1900' ) { $selected = "<SELECT NAME=\"$name\">"; for ( $i = $startYear; $i <= $endYear; $i++ ) { $selected .= "<OPTION "; ( $i == date('Y') ) ? $selected .= "selected='selected'" : $selected = ''; $selected .= "value=\'$i\'>$i</OPTION>"; } $selected .= "</SELECT>"; return($selected); } ?> <? $month = array(1=> "Jan", 2=> "Feb", 3=> "Mar", 4=> "Apr", 5=> "May", 6=> "Jun", 7=> "Jul", 8=> "Aug", 9=> "Sep", 10=> "Oct", 11=> "Nov", 12=> "Dec"); $default = "1"; $option = generate_menu("month", $month, $default); function generate_menu($name, $month, $default="") { $select = "<SELECT NAME=\"$name\">"; foreach($month as $value => $label) { $select .= "<OPTION "; if ($value == $default) $select .= "selected='selected'"; $select .= "value=\'$value\'>$label</OPTION>"; } $select .= "</SELECT>"; return($select); } ?> <? $function = generate_menu("day"); function generate_menu($name) {$sel = "<SELECT NAME=\"$name\">"; for ( $i = 1; $i <= 31; $i++ ) { $sel .= "<OPTION "; ( $i == date('j') ) ? $sel .= "selected='selected'" : $sel = ''; $sel .= "value=\'$i\'>$i</OPTION>"; } $sel .= "</SELECT>"; return($sel); } ?> <td> <?php print $menu;?> </td> <td> <?php print $option;?> </td> <td> <?php print $function;?> </td> </tr> </TABLE> <INPUT TYPE=SUBMIT VALUE="Register"> </form> <?php } else { echo "Thank you for registering"; } ?> error Fatal error: Call to undefined function generate_menu() in C:\xampp\htdocs\form.php on line 65
×
×
  • 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.