Jump to content

Recommended Posts

This is my issue...This is part of a bigger script i am working on and what this part of the coding does is it looks to see if the recruiting status for the site is either open or closed...now as you can see if it is closed it is supposed to show that message and if it is open it is supposed to shot the "Join Us" form...now it all works great except for the fact that i want to be able to use a "Form Validator" that will have a pop-up for leaving a feild blank or invalid email format or leaving the checkbox blank...but the issue im having is that i cannot add any code into the "echo ' " without it coming up with syntax errors...if someone could please post a solution for this you would make me very happy...I have attached the coding as it would be way to big to post...the lines in question are 182-234

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/54082-i-need-some-help/
Share on other sites

 if($_GET['view'] == "JoinUs") {
require("functions.php");				
$query = @mysql_query("SELECT recruiting, security_status, total FROM status");
$row_status = mysql_fetch_array($query);

if($row_status['total'] >= 350 || $row_status['recruiting'] == 1) {
                    echo' <font color="#76A5D5" size="4" face="verdana"><b>Recruiting Is Closed!</b></font>';
				} else {


echo '
<form method="post" name="JoinRequest" action="sendit.php">'; // <--- Missed '; here

<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

 

:)

Link to comment
https://forums.phpfreaks.com/topic/54082-i-need-some-help/#findComment-267346
Share on other sites

<?php

function valid_email($address)
{
  // check an email address is possibly valid
  if (ereg('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$', $address))
    return true;
  else 
    return false;
}

if(isset($_POST["submit"])) { // Rename submit to the name of your form submit field
$errors = array();

if(!valid_email($_POST["email"])) { // Rename email to the name of your form's email field
  $errors[] = "You must enter a valid email address";
}

if(!isset($_POST["textfield"])) { // Example test to see if a field is valid. Duplicate as required
  $errors[] = "You must fill in all fields.";
}

if(count($errors) > 0) {
  foreach($errors as $error) {
   echo "<span style=\"font-color: red;\">Error: {$error}</span><br />\n";
  }
} else {
  // Process the form
}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/54082-i-need-some-help/#findComment-267351
Share on other sites

You're heading towards Javascript here, use this for the checkbox validation:

 

[pre]<input type="checkbox" name="confirm" onclick="this.form['submit'].disabled=false; this.form['confirm'].disabled=true;"/><br />

<input name="submit" type="submit" value="Submit" disabled="disabled" />[/pre]

Link to comment
https://forums.phpfreaks.com/topic/54082-i-need-some-help/#findComment-267362
Share on other sites

javascript should work in there wounldn't it? That is if you know how to do it in javascript...if not that cool i thank you for your help...but if you can do it in javascript that would be cool...cause even if we couldn't add it right to that code we could link to it in an "include or require" formvalidation.js or something

Link to comment
https://forums.phpfreaks.com/topic/54082-i-need-some-help/#findComment-267363
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.