Jump to content

Search the Community

Showing results for tags 'html'.

  • 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

  1. Here is what i need. I have a form with a bunch of text boxes and check box's that i need to submit to mysql database. I know how to submit the text boxes just fine with the insert statment. I have not used check boxes and i need some help on how to insert them into the database. I need them to be enterened in as a 0 or 1. Here is the form <form action="submit.php" method="post"> <table width="1000" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="1400" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6%" height="168"> </td> <td width="87%"> </td> <td width="7%"> </td> </tr> <tr> <td height="37"> </td> <td><table width="100%" height="37" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"><input name="water-purveyor" type="text" id="water-purveyor" size="35" /></td> <td width="29%" valign="bottom"><input name="meter-num" type="text" id="meter-num" size="10" /></td> <td width="39%" valign="bottom"><input type="text" name="permit-num" id="permit-num" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="42"> </td> <td><table width="100%" height="37" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"> <input name="manufacturer" type="text" id="manufacturer" size="20" /></td> <td width="15%" valign="bottom"><input name="meter-size" type="text" id="meter-size" size="10" /></td> <td width="15%" valign="bottom"><input name="model-num" type="text" id="model-num" size="10" /></td> <td width="38%" valign="bottom"><input name="serial-num" type="text" id="serial-num" size="18" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="62"> </td> <td valign="bottom"><table width="100%" height="56" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="61%" valign="bottom"><textarea name="mgmt-info" cols="50" rows="1" id="mgmt-info"></textarea></td> <td width="39%" valign="bottom"><textarea name="mgmt-phone-contact" cols="30" rows="1" id="mgmt-phone-contact"></textarea></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="63"> </td> <td><table width="100%" height="57" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="61%" valign="bottom"><textarea name="owner-info" cols="50" rows="1" id="owner-info"></textarea></td> <td width="39%" valign="bottom"><textarea name="owner-phone-contact" cols="30" rows="1" id="owner-phone-contact"></textarea></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="37"> </td> <td><table width="100%" height="37" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3%"> </td> <td width="21%"><input type="checkbox" name="sab-owner" id="sab-owner" /></td> <td width="44%"><input type="checkbox" name="sab-management" id="sab-management" /></td> <td width="32%"><input type="checkbox" name="sab-other" id="sab-other" /></td> </tr> </table></td> <td width="29%" valign="bottom"><input name="auth-contact" type="text" id="auth-contact" size="20" /></td> <td width="39%" valign="bottom"><input name="auth-phone" type="text" id="auth-phone" size="15" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="65"> </td> <td><table width="100%" height="56" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"><textarea name="bf-assembly-address" cols="30" rows="1" id="bf-assembly-address"></textarea></td> <td width="29%" valign="bottom"><textarea name="onsite-location" cols="20" rows="1" id="onsite-location"></textarea></td> <td width="39%" valign="bottom"><textarea name="primary-business" cols="20" rows="1" id="primary-business"></textarea></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="63"> </td> <td><table width="100%" height="56" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="62" height="8"> </td> <td width="214" height="8"><input type="checkbox" name="new-assembly-yes" id="new-assembly-yes" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="new-assembly-no" id="new-assembly-no" /></td> </tr> </table></td> <td width="29%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="24%" height="8"> </td> <td width="76%" height="8"><input type="checkbox" name="replacement-assembly-yes" id="replacement-assembly-yes" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="replacement-assembly-no" id="replacement-assembly-no" /></td> </tr> </table></td> <td width="39%"><input type="text" name="new-serial-num" id="new-serial-num" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="42"> </td> <td><table width="100%" height="42" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="7%"> </td> <td width="24%"><div style="padding-top:8px; padding-left:4px;"><input type="checkbox" name="poa-secondary" id="poa-secondary" /></div></td> <td width="21%"><div style="padding-top:8px"><input type="checkbox" name="poa-primary" id="poa-primary" /></div></td> <td width="14%"><div style="padding-top:8px"><input type="checkbox" name="poa-fire-system" id="poa-fire-system" /></div></td> <td width="14%"><div style="padding-top:8px; padding-left:4px;"><input type="checkbox" name="poa-landscape" id="poa-landscape" /></div></td> <td width="20%"><div style="padding-top:8px; padding-left:4px;"><input type="checkbox" name="poa-portable" id="poa-portable" /></div></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="64"> </td> <td><table width="100%" height="58" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="33%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6%"> </td> <td width="3%"> </td> <td width="26%"><input type="checkbox" name="svb" id="svb" /></td> <td width="23%"><input type="checkbox" name="pvb" id="pvb" /></td> <td width="21%"><input type="checkbox" name="dc" id="dc" /></td> <td width="21%"><input type="checkbox" name="rp" id="rp" /></td> </tr> <tr> <td> </td> <td valign="bottom"> </td> <td colspan="4"><div style="padding-left:20px;"><input name="toa-other-text" type="text" id="toa-other-text" size="30" /></div></td> </tr> </table></td> <td width="35%"> <input type="text" name="line-pressure" id="line-pressure" /></td> <td width="32%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="19%"> </td> <td width="34%"><input type="checkbox" name="bp-yes" id="bp-yes" /></td> <td width="47%"><input type="checkbox" name="bp-no" id="bp-no" /></td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="64"> </td> <td><table width="100%" height="63" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="83%"> </td> <td width="17%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="32" colspan="5" valign="bottom" align="center"><input name="pvb-aioa-psid" type="text" id="pvb-aioa-psid" size="8" /></td> </tr> <tr> <td width="18%" height="25"> </td> <td width="28%"> </td> <td width="26%"><input type="checkbox" name="pvb-leaked-yes" id="pvb-leaked-yes" /></td> <td width="28%" colspan="2"><input type="checkbox" name="pvb-leaked-no" id="pvb-leaked-no" /></td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="56"> </td> <td><table width="100%" height="56" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="18%"> </td> <td width="22%" valign="top"><table width="100%" height="54" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="5%" height="6"> </td> <td width="49%"> </td> <td width="18%"><input type="checkbox" name="cv1-ct-yes" id="cv1-ct-yes" /></td> <td width="28%"><input type="checkbox" name="cv1-ct-no" id="cv1-ct-no" /></td> </tr> <tr> <td height="6"> </td> <td colspan="2" align="center"><input type="text" name="cv1-psid" id="cv1-psid" size="6" /></td> <td> </td> </tr> <tr> <td height="6"> </td> <td> </td> <td valign="top"><input type="checkbox" name="cv1-leaked-yes" id="cv1-leaked-yes" /></td> <td valign="top"><input type="checkbox" name="cv1-leaked-no" id="cv1-leaked-no" /></td> </tr> </table></td> <td width="22%"><table width="100%" height="54" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="5%" height="6"> </td> <td width="49%"> </td> <td width="19%"><input type="checkbox" name="cv2-ct-yes" id="cv2-ct-yes" style="background-color:transparent;" /></td> <td width="27%"><input type="checkbox" name="cv2-ct-no" id="cv2-ct-no" /></td> </tr> <tr> <td height="6"> </td> <td colspan="2" align="center"><input type="text" name="cv2-psid" id="cv2-psid" size="6" /></td> <td> </td> </tr> <tr> <td height="6"> </td> <td> </td> <td valign="top"><input type="checkbox" name="cv2-leaked-yes" id="cv2-leaked-yes" /></td> <td valign="top"><input type="checkbox" name="cv2-leaked-no" id="cv2-leaked-no" /></td> </tr> </table></td> <td width="20%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="30" colspan="2" align="center"><input type="text" name="dprv-psid" id="dprv-psid" size="8" /></td> <td width="6%"> </td> <td width="21%"> </td> </tr> <tr> <td width="54%"> </td> <td width="19%"><input type="checkbox" name="dprv-dno-yes" id="dprv-dno-yes" /></td> <td> </td> <td><input type="checkbox" name="dprv-dno-No" id="dprv-dno-No" /></td> </tr> </table></td> <td width="18%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="32" colspan="5" valign="bottom" align="center"><input name="pvb-cvha-psid" type="text" id="pvb-cvha-psid" size="8" /></td> </tr> <tr> <td width="20%" height="25"> </td> <td width="20%"> </td> <td width="9%"> </td> <td width="24%"><input type="checkbox" name="pvb-cvha-leaked-yes" id="pvb-cvha-leaked-yes" /></td> <td width="27%"><input type="checkbox" name="pvb-cvha-leaked-no" id="pvb-cvha-leaked-no" /></td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="145"> </td> <td><table width="100%" height="143" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="18%" height="129"> </td> <td width="22%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="54%"> </td> <td width="18%"><input type="checkbox" name="cv1-cleaned-yes" id="cv1-cleaned-yes" /></td> <td width="28%"><input type="checkbox" name="cv1-cleaned-no" id="cv1-cleaned-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv1-replaced-yes" id="cv1-replaced-yes" /></td> <td><input type="checkbox" name="cv1-replaced-no" id="cv1-replaced-no" /></td> </tr> <tr> <td height="40"> </td> <td valign="bottom"><input type="checkbox" name="cv1-rkd-yes" id="cv1-rkd-yes" /></td> <td valign="bottom"><input type="checkbox" name="cv1-rkd-no" id="cv1-rkd-no" /></td> </tr> <tr> <td height="22"> </td> <td><input type="checkbox" name="cv1-springs-yes" id="cv1-springs-yes" /></td> <td><input type="checkbox" name="cv1-springs-no" id="cv1-springs-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv1-guide-yes" id="cv1-guide-yes" /></td> <td><input type="checkbox" name="cv1-guide-no" id="cv1-guide-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv1-other-yes" id="cv1-other-yes" /></td> <td><input type="checkbox" name="cv1-other-no" id="cv1-other-no" /></td> </tr> </table></td> <td width="22%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="51%" height="22"> </td> <td width="21%"><input type="checkbox" name="cv2-cleaned-yes" id="cv2-cleaned-yes" /></td> <td width="28%"><input type="checkbox" name="cv2-cleaned-no" id="cv2-cleaned-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv2-replaced-yes" id="cv2-replaced-yes" /></td> <td><input type="checkbox" name="cv2-replaced-no" id="cv2-replaced-no" /></td> </tr> <tr> <td height="40"> </td> <td valign="bottom"><input type="checkbox" name="cv2-rkd-yes" id="cv2-rkd-yes" /></td> <td valign="bottom"><input type="checkbox" name="cv2-rkd-no" id="cv2-rkd-no" /></td> </tr> <tr> <td height="22"> </td> <td><input type="checkbox" name="cv2-springs-yes" id="cv2-springs-yes" /></td> <td><input type="checkbox" name="cv2-springs-no" id="cv2-springs-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv2-guide-yes" id="cv2-guide-yes" /></td> <td><input type="checkbox" name="cv2-guide-no" id="cv2-guide-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="cv2-other-yes" id="cv2-other-yes" /></td> <td><input type="checkbox" name="cv2-other-no" id="cv2-other-no" /></td> </tr> </table></td> <td width="20%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56%" height="22"> </td> <td width="22%"><input type="checkbox" name="dprv-cleaned-yes" id="dprv-cleaned-yes" /></td> <td width="22%"><input type="checkbox" name="dprv-cleaned-no" id="dprv-cleaned-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="dprv-replaced-yes" id="dprv-replaced-yes" /></td> <td><input type="checkbox" name="dprv-replaced-no" id="dprv-replaced-no" /></td> </tr> <tr> <td height="40"> </td> <td valign="bottom"><input type="checkbox" name="dprv-rkd-yes" id="dprv-rkd-yes" /></td> <td valign="bottom"><input type="checkbox" name="dprv-rkd-no" id="dprv-rkd-no" /></td> </tr> <tr> <td height="22"> </td> <td><input type="checkbox" name="dprv-springs-yes" id="dprv-springs-yes" /></td> <td><input type="checkbox" name="dprv-springs-no" id="dprv-springs-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="dprv-guide-yes" id="dprv-guide-yes" /></td> <td><input type="checkbox" name="dprv-guide-no" id="dprv-guide-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="dprv-other-yes" id="dprv-other-yes" /></td> <td><input type="checkbox" name="dprv-other-no" id="dprv-other-no" /></td> </tr> </table></td> <td width="18%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="48%" height="22"> </td> <td width="28%"><input type="checkbox" name="pvb-cleaned-yes" id="pvb-cleaned-yes" /></td> <td width="24%"><input type="checkbox" name="pvb-cleaned-no" id="pvb-cleaned-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="pvb-replaced-yes" id="pvb-replaced-yes" /></td> <td><input type="checkbox" name="pvb-replaced-no" id="pvb-replaced-no" /></td> </tr> <tr> <td height="40"> </td> <td valign="bottom"><input type="checkbox" name="pvb-rkd-yes" id="pvb-rkd-yes" /></td> <td valign="bottom"><input type="checkbox" name="pvb-rkd-no" id="pvb-rkd-no" /></td> </tr> <tr> <td height="22"> </td> <td><input type="checkbox" name="pvb-springs-yes" id="pvb-springs-yes" /></td> <td><input type="checkbox" name="pvb-springs-no" id="pvb-springs-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="pvb-guide-yes" id="pvb-guide-yes" /></td> <td><input type="checkbox" name="pvb-guide-no" id="pvb-guide-no" /></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="pvb-other-yes" id="pvb-other-yes" /></td> <td><input type="checkbox" name="pvb-other-no" id="pvb-other-no" /></td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="29"> </td> <td><table width="100%" height="29" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="18%"> </td> <td width="82%"><table width="100%" height="29" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="29%"> </td> <td width="19%" valign="top"><input name="valve-num" type="text" id="valve-num" size="12" style="height:14px;" /></td> <td width="14%"> <input type="checkbox" name="repaired" id="repaired" /> </td> <td width="15%"> <input type="checkbox" name="replaced" id="replaced" /> </td> <td width="23%"> <input type="checkbox" name="both-ok" id="both-ok" /> </td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="62"> </td> <td><table width="100%" height="60" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="18%"> </td> <td width="22%" valign="top"><table width="100%" height="41" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" height="19"> </td> <td width="29%"> </td> <td width="20%"><input type="checkbox" name="ft-cv1-ct-yes" id="ft-cv1-ct-yes" /></td> <td width="26%"><input type="checkbox" name="ft-cv1-ct-no" id="ft-cv1-ct-no" /></td> </tr> <tr> <td colspan="3" align="center"><input name="ft-cv1-psid" type="text" id="ft-cv1-psid" size="8" /></td> <td> </td> </tr> </table></td> <td width="22%" valign="top"><table width="100%" height="41" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" height="19"> </td> <td width="25%"> </td> <td width="24%" valign="top"><div style="padding-left:4px;"><input type="checkbox" name="ft-cv2-ct-yes" id="ft-cv2-ct-yes" /></div></td> <td width="26%"><input type="checkbox" name="ft-cv-ct-no" id="ft-cv2-ct-no" /></td> </tr> <tr> <td colspan="3" align="center"><input type="text" name="ft-cv2-psid" id="ft-cv2-psid" size="8" /></td> <td> </td> </tr> </table></td> <td width="20%" align="center"><input name="ft-dprv-psid" type="text" id="ft-dprv-psid" size="8" /></td> <td width="18%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="36%" height="22"> </td> <td colspan="2" align="center"><input name="ft-ai-psid" type="text" id="ft-ai-psid" size="4" /></td> <td width="3%"> </td> <td width="20%"> </td> </tr> <tr> <td height="25"> </td> <td width="14%"> </td> <td colspan="2" align="center"><input name="ft-cv-psid" type="text" id="ft-cv-psid" size="3" /></td> <td> </td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td colspan="3" height="32"></td> </tr> <tr> <td height="54"> </td> <td valign="bottom"><table width="100%" height="" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="49%" rowspan="2" valign="bottom"><textarea name="tc-info" cols="45" rows="1" id="tc-info"></textarea></td> <td width="51%" rowspan="2" valign="bottom"><textarea name="tc-info2" cols="40" rows="1" id="tc-info2"></textarea></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="37"> </td> <td valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-bottom:4px;"> <tr> <td width="23%"><input name="itb" type="text" id="itb" size="20" /></td> <td width="26%"><input name="certified-tester-num2" type="text" id="certified-tester-num2" size="15" /></td> <td width="26%"><input name="date-failed" type="text" id="date-failed" size="15" /></td> <td width="25%"><input name="tk-serial-num" type="text" id="tk-serial-num" size="20" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="39"> </td> <td valign="bottom"><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="23%"> </td> <td width="52%"> </td> <td width="25%"> </td> </tr> </table></td> <td> </td> </tr> <tr> <td height="38"> </td> <td valign="bottom"><table width="100%" height="32" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="23%"><input name="ftb" type="text" id="ftb" size="20" /></td> <td width="26%"><input name="ftb-certified-tester-num" type="text" id="ftb-certified-tester-num" size="20" /></td> <td width="26%"><input name="date-passed" type="text" id="date-passed" size="15" /></td> <td width="25%"><input name="ftb-tk-serial-num" type="text" id="ftb-tk-serial-num" size="20" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td height="123"> </td> <td><textarea name="comments" id="comments" cols="105" rows="3"></textarea></td> <td> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> </form> Here is just a sample of the insert code that i have: <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; $table = "sysform"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $water-purveyor = $_POST['water-purveyor']; $meter-num = $_POST['meter-num']; $permit-num = $_POST['permit-num']; $svb = $_POST['svb']; $pvb = $_POST['pvb']; $dc = $_POST['dc']; $rp = $_POST['rp']; $sql = "INSERT INTO $table ('water-purveyor', 'meter-num', 'permit-num','...', 'svb', 'pvb', 'dc', 'rp') VALUES ('$water-purveyor', '$meter-num', '$permit-num','$...', '$svb', '$pvb', '$dc', '$rp')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close(); ?> Can anyone help me on how to under stand how to sumbit the check box's to where i have a 1 or 0. Also i need to use the get function to pull the data back to the form. Here is the statment i have for that just as an example: <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; $table = "sysform"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $water-purveyor = $_POST['water-purveyor']; $meter-num = $_POST['meter-num']; $permit-num = $_POST['permit-num']; $svb = $_POST['svb']; $pvb = $_POST['pvb']; $dc = $_POST['dc']; $rp = $_POST['rp']; $sql="SELECT * from $table where sequence = '".$_GET["sequence"]."' "; $rs=mysql_query($sql,$conn) or die(mysql_error()); $result=mysql_fetch_array($rs); ?> <form action="" method="get"> <table width="1000" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="1400" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6%" height="168"> </td> <td width="87%"> </td> <td width="7%"> </td> </tr> <tr> <td height="37"> </td> <td><table width="100%" height="37" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="32%" valign="bottom"><input name="water-purveyor" type="text" id="water-purveyor" size="35" value="<?php echo '$water-purveyor'?>" /></td> <td width="29%" valign="bottom"><input name="meter-num" type="text" id="meter-num" size="10" value="<?php echo '$meter-num'?>" /></td> <td width="39%" valign="bottom"><input type="text" name="permit-num" id="permit-num" value="<?php echo '$permit-num'?>" /></td> </tr> </table> </form>
  2. I am using this php function to display categories and sub-categories in a list. function displayMenuMobile(&$cats, $parent, $level=0) { switch ($level) { case 0: $class = "menu-phone"; $menuId = "nav"; break; case 1: $class = "sub-menu"; $menuId = ""; break; } if ($parent==0) { foreach ($cats[$parent] as $id=>$nm) { displayMenuMobile($cats, $id); } } else { echo "<ul class='$class' id='$menuId'>\n"; $classParent = ''; if ($level == 0) { $classParent = "class='parent'"; } foreach ($cats[$parent] as $id=>$nm) { echo "<li $classParent><a href='#'><span>$nm</span></a>\n"; if (isset($cats[$id])) { displayMenuMobile($cats, $id, $level+1); //increment level } } echo "</li></ul>\n"; } } Its displaying the list but it is not rendering HTML properly. This is rendering HTML: <ul class='menu-phone' id='nav'> <li class='parent'><a href='#'><span>Hot Deals</span></a> <li class='parent'><a href='#'><span>Pantry</span></a> <ul class='sub-menu' id=''> <li ><a href='#'><span>Biscuits</span></a> <li ><a href='#'><span>Canned Foods</span></a> <li ><a href='#'><span>Canned Vegetables</span></a> <li ><a href='#'><span>Chips, Snacks & Nuts</span></a> </ul> <li class='parent'><a href='#'><span>Drinks</span></a> <ul class='sub-menu' id=''> <li ><a href='#'><span>Coffee</span></a> <li ><a href='#'><span>Flavoured Milk Drinks</span></a> </ul> <li class='parent'><a href='#'><span>Confectionery</span></a> <ul class='sub-menu' id=''> <li ><a href='#'><span>Chocolate</span></a> <li ><a href='#'><span>Mints &Bathroom & Toilet Gums </span></a></li> </ul> <li class='parent'><a href='#'><span>Household</span></a> <ul class='sub-menu' id=''> <li ><a href='#'><span>Air Fresheners</span></a> <li ><a href='#'><span>Bathroom & Toilet</span></a> <li ><a href='#'><span>Cleaning</span></a> <li ><a href='#'><span>Electrical</span></a> <li ><a href='#'><span>Homeware</span></a> <li ><a href='#'><span>Laundry</span></a></li> </ul> <li class='parent'><a href='#'><span>Cosmetics</span></a> <ul class='sub-menu' id=''> <li ><a href='#'><span>Eye Makeup</span></a> <li ><a href='#'><span>Lip Gloss & Moisturisers</span></a> <li ><a href='#'><span>Nail Polish</span></a></li> </ul> </li> </ul> Problem is its not rendering closing </li> tag in the parent and nested list. Can anybody tell me whats wrong with this? Hope somebody may help me out. Thank you.
  3. Hi everyone, I made script in php that working with HTML select and option, but I can't figure how to do that. Is any website that can provide tutorial about select and option with php database. I mean, for example, I set up the 12 months in the select, then drop menu to pick an option, I pick July, then click on submit, then php display the list of name who have birthday on July. Get it? Please ask me if you are not sure you understand what i mean... Thank you in advance time. Gary
  4. Hi all, I am a real newbie with PHP and mysql. I am trying to create a thumbnail carousel to present all the web applications we have in house.I am using some code from this demo because it does close to everything I need. The problem is that it displays only one image per slide and I would like to display multiple items per slide instead. Is it possible with a foreach loop for example? Code: <?php include_once('db.php'); $query = "select * from images order by id desc limit 6"; $res = mysqli_query($connection,$query); $count = mysqli_num_rows($res); $slides=''; $Indicators=''; $counter=0; while($row=mysqli_fetch_array($res)) { $title = $row['title']; $desc = $row['desc']; $image = $row['image']; if($counter == 0) { $Indicators .='<li data-target="#carousel-example-generic" data-slide-to="'.$counter.'" class="active"></li>'; $slides .= '<div class="item active"> <img src="images/'.$image.'" alt="'.$title.'" /> <div class="carousel-caption"> <h3>'.$title.'</h3> <p>'.$desc.'.</p> </div> </div>'; } else { $Indicators .='<li data-target="#carousel-example-generic" data-slide-to="'.$counter.'"></li>'; $slides .= '<div class="item"> <img src="images/'.$image.'" alt="'.$title.'" /> <div class="carousel-caption"> <h3>'.$title.'</h3> <p>'.$desc.'.</p> </div> </div>'; } $counter++; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Dynamic image slider using twitter bootstrap & PHP with MySQL | PGPGang.com</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <style type="text/css"> img {border-width: 0} * {font-family:'Lucida Grande', sans-serif;} </style> </head> <body onload="changePagination('0','first')"> <h2>Dynamic image slider using twitter bootstrap & PHP with MySQL Example. => <a href="http://www.phpgang.com/">Home</a> | <a href="http://demo.phpgang.com/">More Demos</a></h2> <link rel="stylesheet" href="css/bootstrap.min.css" /> <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script> <script src="js/bootstrap.min.js"></script> <style> .carousel-caption { background-image: url("http://www.phpgang.com/wp-content/themes/PHPGang_v2/img/bg_sidebar.png"); } .carousel-inner>.item>img, .carousel-inner>.item>a>img { height:400px; width:700px; } </style> <div class="container" style="width: 730px;"> <h2>Dynamic Image Slider</h2><span style="float: right;margin-top: -30px;"><a href="addnew.php">Add More Images</a></span> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <?php echo $Indicators; ?> </ol> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <?php echo $slides; ?> </div> <!-- Controls --> <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> </div> </body> </html> Thanks, Alex
  5. I want to create a drop down menu that display main categories then all child categories with all of their sub child list like the one shown in below pic I am using a table named categories which uses hierarchical system like parent id, right id, left id and level looks like in below pic here is my categoriesTest.php <?php include 'common.php'; $query = "SELECT cat_id, parent_id, cat_name FROM " .$DBPrefix. "categories ORDER BY cat_name"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $items = mysql_fetch_assoc($res); $html = ''; $parent = 0; $parent_stack = array(); // $items contains the results of the SQL query $children = array(); foreach ( $items as $item ) $children[$items['parent_id']][] = $item; while ( $option = each( $children[$parent] ) ) { if ( !empty( $option ) ) { // 1) The item contains children: // store current parent in the stack, and update current parent if ( !empty( $children[$option['value']['id']] ) ) { $html .= '<li>' . $option['value']['title'] . '</li>'; $html .= '<ul>'; array_push( $parent_stack, $parent ); $parent = $option['value']['id']; } // 2) The item does not contain children else $html .= '<li>' . $option['value']['title'] . '</li>'; } // 3) Current parent has no more children: // jump back to the previous menu level else { $html .= '</ul>'; $parent = array_pop( $parent_stack ); } } // At this point, the HTML is already built echo $html; ?> the above code not working and am not sure it is the correct way. can anyone help me out?? Thanks
  6. <script type="text/javascript" language="javascript"> function disableFunc() { document.getElementById("groupselect").disabled = true; } </script> <form method="post" class="subform" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>"> <div class="row" style="background: skyblue; margin-top:-23px"> <div class="col-sm-2"> <div class="input-group"> <select id="groupselect" class="form-control" name="groupid" onchange="disableFunc()"> <option name="0"<?php echo ($_POST['groupid'] == '0') ? ' selected="selected"' : ''; ?> value="0" >GROUP</option> <option name="1"<?php echo ($_POST['groupid'] == '1') ? ' selected="selected"' : ''; ?> value="1" >1</option> <option name="2"<?php echo ($_POST['groupid'] == '2') ? ' selected="selected"' : ''; ?> value="2" >2</option> <option name="3"<?php echo ($_POST['groupid'] == '3') ? ' selected="selected"' : ''; ?> value="3" >3</option> <option name="4"<?php echo ($_POST['groupid'] == '4') ? ' selected="selected"' : ''; ?> value="4" >4</option> <option name="5"<?php echo ($_POST['groupid'] == '5') ? ' selected="selected"' : ''; ?> value="5" >5</option> <option name="6"<?php echo ($_POST['groupid'] == '6') ? ' selected="selected"' : ''; ?> value="6" >6</option> The onchange function works as it shld. My problem is the HTML. I got this select box code from another forum. Without the onchange event in the code, when the user selects a Groupid option, it automatically loads another select box with names. But with it in the code (as I've shown it here), the select box gets disabled immediately causing no names to be loaded in the other select box. I need to be able to load the other select box with names before the groupid select box disables. Any help on this is appreciated. Thanks.
  7. Hello, I have this small html and php files and the problem is I can't send any emails... When I press submit it just opens php file on the browser. Can anyone help me? Here is the code <html> <link href="style.css" rel="stylesheet" type="text/css"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Contact Form</title> </head> <body> <header class="body"> </header> <section class="body"> <form method="post" action="mail.php"> <label>Name</label> <input name="name" placeholder="Type Here"> <label>Email</label> <input name="email" type="email" placeholder="Type Here"> <label>Message</label> <textarea name="message" placeholder="Type Here"></textarea> <label>*What is 2+2? (Anti-spam)</label> <input name="human" placeholder="Type Here"> <input id="submit" name="submit" type="submit" value="Submit"> </form> </section> <footer class="body"> </footer> </body> </html> <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: TangledDemo'; $to = 'myemail@gmail.com'; $subject = 'Hello'; $human = $_POST['human']; $body = "From: $name\n E-Mail: $email\n Message:\n $message"; if ($_POST['submit']) { if ($name != '' && $email != '') { if ($human == '4') { if (mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '4') { echo '<p>You answered the anti-spam question incorrectly!</p>'; } } else { echo '<p>You need to fill in all required fields!!</p>'; } } ?>
  8. Hi, I have all the elements I need but I need to connect the dots... Situation... I have a job table that is brought in with this variable <?php $row = 1; if (($handle = fopen($statfile, "r")) !== FALSE) { echo '<table class="sortable" border="0">'; while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { if (substr($data[0],0,3)!='HDR' && substr($data[0],0,3) != 'JOB' ) continue; $num = count($data); if (substr($data[0],0,3)=='HDR') { echo '<thead><tr>'; }else{ echo '<tr>'; } for ($c=1; $c <= 4; $c++) { //echo $data[$c] . "<br />\n"; if(empty($data[$c])) { $value = " "; }else{ $value = trim($data[$c]); } if (substr($data[0],0,3)=='HDR') { echo '<th style="text-align:center">'.$value."</th>\n"; }else{ if ($c==1) { echo '<td style="text-align:center"><a href="http://wfbscd13/cgi-bin/aplog.cgi?type=job&logname='.$value.'&hostname='.$host.'" target="_blank">'.$value."</a></td>\n"; }else{ echo '<td style="text-align:center">'.$value."</td>\n"; } } } if (substr($data[0],0,3)=='HDR') { echo '</tr></thead><tbody>'; }else{ echo '</tr>'; } $row++; } echo '</tbody></table>'; fclose($handle); } ?> I attached a picture to show my screen... The right hand div with the list of jobs is on the right. I have it set so I can hover over the row and it highlights a row. Here is that code... It is jquery (1.9.1) <script type="text/javascript"> $("tr").not(':first').hover( function () { $(this).css("background","#d3d3d3"); }, function () { $(this).css("background",""); } ); </script> And finally the php query for the header.... <?php $row = 1; if (($handle = fopen("status.txt", "r")) !== FALSE) { echo '<table class="sortable" border="0">'; while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { if ($row > 1 && substr($data[0],0,3) != 'JOB' ) continue; $num = count($data); if ($row == 1) { echo '<thead><tr>'; }else{ echo '<tr>'; } for ($c=4; $c <$num; $c++) { //echo $data[$c] . "<br />\n"; if(empty($data[$c])) { $value = " "; }else{ $value = trim($data[$c]); } if (substr($data[0],0,3)=='HDR') { echo '<th style="text-align:center">'.$value."</th>\n"; }else{ if ($c==1) { echo '<td style="text-align:center">'.$value."</td>\n"; }else{ echo '<td style="text-align:center">'.$value."</td>\n"; } } } if (substr($data[0],0,3)=='HDR') { echo '</tr></thead><tbody>'; }else{ echo '</tr>'; } $row++; } echo '</tbody></table>'; fclose($handle); } ?> What I need is to show this last query in the header on hover of the first query.... But I can't seem to connect the dots... Can anyone help me?
  9. I have 3 variables coming from 3 columns from a table. I want to insert these variables into 3 columns in a different table. Variables are name, cover, and pageno. The issue is I can see the values in the hidden inputs this is when the page loads when nothing is selected in the combobox??? If I select book number two the same values are in the hidden inputs. If I select book one this is what I see because when the page loads it populates the values as book 1. <input type="hidden" name="cover" value="cover 1"> <input type="hidden" name="pageno" value="pageno 1"> If I select book two this is what I see. <input type="hidden" name="cover" value="cover 1"> <input type="hidden" name="pageno" value="pageno 1"> Make sense? If not, no matter which book I select I see the same values. Here's the code. <select name="name"> <option value="<?php echo "{$_POST['name']}"; ?>"> </option> <?php include('theconnection.php'); $con = mysqli_connect($host,$user,$pass,$dbName); if (!$con) { die('cannot connect: ' . mysqli_error($con)); } mysqli_select_db($con,"thebooks"); $result = mysqli_query($con,"SELECT * FROM books"); $result = mysqli_query($con,"SELECT b.id, b.name, b.cover, b.pageno FROM books"); $cover = ''; $pageno = ''; while($row = mysqli_fetch_array($result)) { echo ("<option value='$row[name]'>$row[name] $row[cover], $row[pageno] </option>"); $cover = "$row[cover]"; $pageno = "$row[pageno]"; } ?> </select> <input type="hidden" name="cover" value="<?php echo $cover; ?>"> <input type="hidden" name="pageno" value="<?php echo $pageno; ?>"> Maybe Javascript will work? I can't figure out how to do this with Javascript either.
  10. I have the following html code for a form; <form action="email.php" method ="POST" > <label>Name</label><br> <input type="text" value="" class="form" name ="name"><br> <label>Email</label><br> <input type="text" value="" class="form" name ="email"><br> <label>Message</label><br> <textarea rows ="3" class ="form" name ="message"></textarea> <label></label><br> <input type="submit" value="submit"> </form> the form has the action of a file called email.php-this file is meant to send the users details to an email address using the mail function. It contains the following; <html> <body> Thankyou <?php echo $_POST["name"]. ","; ?> <br> <?php echo $_POST["email"]; ?> Will be contacted soon. <?php $to = "example@example.com"; $name = $_POST["name"]; $email =$_POST["email"]; $message = $_POST["message"]; $subject="Web Design"; $headers = 'From:'. $email . "\r\n" . 'Reply-To:'. $name . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers) header("Location: index.html")?> </body> </html> I have tried the code with a working email address however none of it seems to work- what happens is when the submit button is clicked the user is redirected a plain white page ("/email.php"). Looking for help urgently. Kind Regards, R.
  11. I have a set of items to select from mysql. And then I want to display these items on my page with different 'markup`. This is how my HTML look like for each item. <ul class='unstyled main-facilities row'> <li class='info-facility-item '> <span class='fa-stack'> <i class='fa fa-square fa-stack-2x'></i> <i class='fa fa fa-cutlery fa-stack-1x fa-inverse'></i> </span> Item-01 </li> <li class='info-facility-item '> <span class='fa-stack'> <i class='fa fa-square fa-stack-2x'></i> <i class='fa fa fa-rss fa-stack-1x fa-inverse'></i> </span> Item-02 </li> <li class='info-facility-item '> <span class='fa-stack'> <i class='fa fa-square fa-stack-2x'></i> <i class='fa fa-refresh fa-stack-1x fa-inverse'></i> </span> Item-03 </li> ... ... ... </ul> If I have same markup for each item, then I can do it like this: // Fetch all the records: while ($stmt->fetch()) { $result = "<li class='info-facility-item '>\n"; $result .= " <span class='fa-stack'>\n"; $result .= " <i class='fa fa-square fa-stack-2x'></i>\n"; $result .= " <i class='fa fa fa-rss fa-stack-1x fa-inverse'></i>\n"; $result .= " </span>{$item}\n"; $result .= "</li>\n"; $items[] = $result; } } But I am not sure how to modify my `while` loop to render different markup for each item. Can anybody tell me is there a way to do this in PHP? Thank you.
  12. Is there away to get something unique on a client computer? I read about ActiveX but it is only works on IE. I need something that can work on other browsers also, maybe on PHP or on Javascript.
  13. I am trying to send a basic email that is multipart via the mail() function in php. I am not interested in using PHPmail. This should be very light weight. Currently when I send email to gmail, it is sending the html part as plain text so all the tags are showing. Here is my code: //GET VAR INPUT $to = htmlentities($_GET['to']); $friendly_from = htmlentities($_GET['friendly_from']); $email_from = htmlentities($_GET['email_from']); $subject = htmlentities($_GET['subject']); $text = htmlentities($_GET['text']); $html = htmlentities($_GET['html']); //SEND EMAIL # Setup mime boundary $mime_boundary = 'Multipart_Boundary_x' . md5(time()) . 'x'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; $headers .= "Reply-To: " . $email_from . " \r\n"; # Add in plain text version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/plain; charset=\"charset=us-ascii\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $text; $body.= "\n\n"; # Add in HTML version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/html; charset=\"UTF-8\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $html; $body.= "\n\n"; # End email $body.= "--$mime_boundary--\n"; # <-- Notice trailing --, required to close email body for mime's # Finish off headers $headers .= "From: " . $friendly_from . " <" . $email_from . ">\r\n"; $headers .= "X-Sender-IP: " . $_SERVER[SERVER_ADDR] . "\r\n"; $headers .= 'Date: ' . date('n/d/Y g:i A') . "\r\n"; # Mail it out return mail($to, $subject, $body, $headers); Here is what I am receiving. (And yes I can accept html emails).
  14. I am trying to display some images dynamically from a mysql table. This is what I tried it with PHP and its working for me. // Fetch all the records: while ($stmt->fetch()) { $html = " <div class='row-fluid custom'>\n"; $html .= " <div class='span6'>\n"; $html .= " <img src='images/{$image}'>\n"; $html .= " </div>\n"; $html .= " </div>\n"; //Add images to array $images[] = $html; } And this is the markup from about PHP: <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-1.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-2.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-3.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-4.png'> </div> </div> But my problem is, now I need to modify above Markup to like this. <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-1.png"> </div> <div class="span6"> <img src="images/cond-2.png"> </div> </div> <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-3.png"> </div> <div class="span6"> <img src="images/cond-4.png"> </div> </div> Can anybody tell me how I create like that markup using php? Hope somebody may help me out. Thank you.
  15. I have used hierarchical data modal to store animals in database. Animal have only main and subcategory, and this is the result when I retrieving the Full Tree of Animals. SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3 FROM categories AS t1 LEFT JOIN categories AS t2 ON t2.parent = t1.category_id LEFT JOIN categories AS t3 ON t3.parent = t2.category_id WHERE t1.name = 'Pets'; +------+------+-------------------+ | lev1 | lev2 | lev3 | +------+------+-------------------+ | Pets | Dogs | Bulldog | | Pets | Dogs | Bullmastiff | | Pets | Dogs | Chow Chow | | Pets | Dogs | Cocker Spaniel | | Pets | Dogs | German Shepherd | | Pets | Dogs | Gordon Setter | | Pets | Cats | American Bobtail | | Pets | Cats | Balinese | | Pets | Cats | Birman | | Pets | Cats | British Shorthair | | Pets | Cats | Burmese | +------+------+-------------------+ 11 rows in set (0.04 sec) My question is, I'm having trouble displaying this information as an unordered list. My expecting result would be something like this: <ul class="list-unstyled categorychecklist "> <li><input type="checkbox" value=""> Dogs <ul class="children"> <li><input type="checkbox" value=""> Bulldog</li> <li><input type="checkbox" value=""> Bullmastiff</li> <li><input type="checkbox" value=""> Chow Chow</li> <li><input type="checkbox" value=""> Cocker Spaniel</li> <li><input type="checkbox" value=""> German Shepherd</li> <li><input type="checkbox" value=""> Gordon Setter</li> </ul> </li> <li><input type="checkbox" value=""> Cats <ul class="children"> <li><input type="checkbox" value=""> American Bobtail</li> <li><input type="checkbox" value=""> Balinese</li> <li><input type="checkbox" value=""> Birman</li> <li><input type="checkbox" value=""> British Shorthair</li> <li><input type="checkbox" value=""> Burmese</li> </ul> </li> <li><input type="checkbox" value=""> Birds</li> </ul> Hope somebody may help me out. Thanks in advance.
  16. I'm using a plugin to include a photo gallery on a wordpress site. At the bottom of the page in the footer I include <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> just like the samples I look at do it here http://getbootstrap.com/getting-started/#examples The problem is that the plugin doesn't work when I include jquery. I posted the probelm here https://wordpress.org/support/topic/huge-it-doesnt-work-with-google-ajax-jquery And the reply was jQuery should not be called this way? That's the way the samples do it You try to call jQuery in no standard way? It's the same in every footer Sooo, how do you call jquery and what is the standard way? Thanks in advance
  17. I have a form that an agent can fill out and then hit send and it will auto generate an email for them. I had it working and wanted to update to dynamic drop downs. now my clear and send buttons no longer work. <head> <title>Research / Serviceability Email</title> <style type="text/css"> .style166 {color: #FFFFFF} </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> function clearresearch() { document.getElementById("text-one").selectedIndex = "base"; document.getElementById('esl').value=''; document.getElementById('account').value=''; document.getElementById('name').value=''; document.getElementById('address').value=''; document.getElementById('er').value=''; document.getElementById('issue').value=''; document.getElementById("text-two").selectedIndex = ""; } function mailresearch() { if (document.getElementById('txet-one').value="research") { var esl = document.getElementById('esl').value; var acct = document.getElementById('account').value; var name = document.getElementById('name').value; var address = document.getElementById('address').value; var er = document.getElementById('er').value; var issue = document.getElementById('issue').value; var type = document.getElementById('type').value; var sendmail = 'mailto:Email Address 1' + '?subject=' + esl + " / " + "ER" + er + " / " + type + '&body=' + "Account Number: " + acct + "%0D%0A" + "Customer Name: " + name + "%0D%0A" + "Customer Address: " + address + "%0D%0A" + "ER Ticket Number and Type: " + er + " / " + type + "%0D%0A%0D%0A" + "Description of Issue:" + "%0D%0A%0D%0A" + issue + "%0D%0A%0D%0A"; win = window.open(sendmail, 'emailWindow'); if (win && win.open && !win.closed) win.close(); } else { var esl = document.getElementById('esl').value; var acct = document.getElementById('account').value; var name = document.getElementById('name').value; var address = document.getElementById('address').value; var er = document.getElementById('er').value; var issue = document.getElementById('issue').value; var type = document.getElementById('type').value; var sendmail = 'mailto:Email Address2' + '?subject=' + esl + " / " + "ER" + er + " / " + type + '&body=' + "Account Number: " + acct + "%0D%0A" + "Customer Name: " + name + "%0D%0A" + "Customer Address: " + address + "%0D%0A" + "ER Ticket Number and Type: " + er + " / " + type + "%0D%0A%0D%0A" + "Description of Issue:" + "%0D%0A%0D%0A" + issue + "%0D%0A%0D%0A"; win = window.open(sendmail, 'emailWindow'); if (win && win.open && !win.closed) win.close(); } } $(function() { $("#text-one").change(function() { $("#text-two").load("textdata/" + $(this).val() + ".txt"); }); }); </script> </head> <body> <form name="research"> <table id="callnotesr"> <tbody> <tr> <td bgcolor="#0000FF"><div align="center" class="style166">Research / Serviceability Email</div></td> </tr> <tr><td width="235" rowspan="5" valign="top" style="border:1px solid black; border-color:black;"> <div> <div align="">Research or Serviceability</div> <select id="text-one"> <option selected value="base">Please Select</option> <option value="research">Research</option> <option value="service">Serviceability</option> </select> </div> <div> <div align="">ESL Ticket Number</div> <div align=""> <input type="text" class="style44" id="esl" size="60" value="" > </div> <div> <div align="">Account Number</div> <div align=""> <input type="text" class="style44" id="account" size="60" value="" > </div> <div> <div align="">Customer Name</div> <div align=""> <input type="text" class="style44" id="name" size="60" value=""> </div> <div> <div align="">Customer Address</div> <div align=""> <input type="text" class="style44" id="address" size="60" value=""> </div> <div> <div align="">ER Ticket Number</div> <div align=""> <input type="text" class="style44" id="er" size="60" value=""> </div> <div> <div align="">ER Ticket Type</div> <select id="text-two"> <option>Please choose from above</option> </select> </div> <div> <div align="">Description of Issue</div> <div align="center"> <textarea cols="50" rows="10" id="issue" ></textarea> </div> <br /> <div> </form> <div align="center" class="style44"> <button name="clearresearch" type="button" class="style115" id="clearresearch" onclick="clearresearch()" value="Clear">Clear</button> <button name="mail" type="button" class="style115 " id="mail" onclick="mailresearch()" value="Send">Send</button> </div> </td> </tr></tbody></table> </body> </html>
  18. I apologize in advance if this has already been covered before, but I'm extremely new to php and a lot of this is over my head... That being said, I've created a form, and I can't for the life of me get it to send like it's supposed to. I've scoured ever forum and tutorial I can think of, and have tried every possible code combination I can think of, but nothing seems to be help. Whenever I hit send on the website, I get a redirect that just says "Forbidden". Nothing else. I'm not sure what information I should provide for forum members to be able to help me, but the website/page I'm having issues with is: http://www.joessportscafe.com/feedback . If you go into the source code, the php starts on line 239 and ends on 519. I can provide whatever more information you need if anyone would be awesome enough to help me. I would REALLY appreciate it.
  19. Hello, I am new to PHP, so I decided the best way to learn is to build a CMS, that I can build and adapt as time progresses. I am wanting to create a setup/install wizard for when a user first uploads the website and then visits the website. I attempted to do this on my own, but it did not work, but hey I still included the code in-case I was close to getting it working. (See below). I am wanting to have a HTML form that will contain the input fields, where the user will enter their database host, username, and password. And all of the details in the form will replace the mysqli connection in the config.php file, which is seperate from the install file. That is all I really need help with at the moment, as creating users, etc is pretty easy (even though I am new to PHP). My "attempted" code: - Install.php: <?php /* Config required to replace the database strings */ require('config/config.php'); /* HTML Form to be echoed for the user */ $form = " <form name='form' action='' method='get'> <input type='text' name='host' placeholder='Database host' /> <input type='text' name='database' placeholder='Database name' /> <input type='text' name='username' placeholder='Database username' /> <input type='password' name='password' placeholder='Database password' /> <input type='submit' name='submit' value='Change values' /> </form> "; /* Echo the form so I can see it */ echo $form; /* Get the results from the HTML Form */ $gethost = $_GET['host']; $getdb = $_GET['database']; $getuser = $_GET['username']; $getpass = $_GET['password']; /* Replace the database connections in config.php */ /* However, does not work :/ */ if (isset($_GET['submit'])) { str_replace($gethost,$host); } ?> - Config.php: <?php $host = "localhost"; $username = "root"; $password = ""; $database = "website"; /* Change this line in the HTML Form in setup.php */ $dbc = mysqli_connect($host, $username, $password, $database); ?> Thanks in advanced, Unique
  20. <?php $con=mysqli_connect("localhost","my_user","","shazz"); $query = mysqli_query($con,"SELECT * from posts2 order by rand() LIMIT 0,4"); $post_title ="shazz"; while ($row=mysqli_fetch_array($query)) { $post_id=$row['post_id']; $post_title=$row['post_title']; $post_date=$row['post_date']; $post_author=$row['post_author']; $post_image=$row['post_image']; $post_keywords=$row['post_keywords']; $post_content=substr($row['post_content'],0,200); } ?> the following are the errors im facing: Warning: mysqli_connect(): (HY000/1044): Access denied for user ''@'localhost' to database 'shazz' inC:\xampp\htdocs\shazz\include\main_content.php on line 3 Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given inC:\xampp\htdocs\shazz\include\main_content.php on line 4 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given inC:\xampp\htdocs\shazz\include\main_content.php on line 6
  21. I am trying to display Json data using PHP but I have ran into a problem. This is the json: }, { "node_title": "Room", "Room description": "This is Room 1", "Room name": "Room 1", "Room Type": "Bedroom", "Room attributes": [ ] }, { "node_title": "Room", "Room description": "This is Room 2", "Room name": "Room 2", "Room Type": "Bedroom", "Room attributes": [ This is my PHP: <?php $code = isset($_POST['search']) ? $_POST['search'] : '123nocode123456'; $roomjson = file_get_contents("http://my.json.com/". $code); $roomobj = json_decode($roomjson); ?> <?php echo '<div role="tabpanel"> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>'; if (empty($roomobj)) { echo '</div>'; }else{ if ($roomobj{0}->{'Room Type'} == 'Bedroom') { echo '<li role="presentation"><a href="#bedroom1" aria-controls="bedroom1" role="tab" data-toggle="tab">'; echo ($roomobj{0}->{'Room name'}); echo '</a></li></div>'; ?> The problem is, I have two json 'nodes' that have the same 'Room Type' value, so how can I differentiate between the two? But I need to display both of them. I think I can use foreach but I need the values 'Room Name' to be in separate <li>.
  22. Hi all, I have a form that submits data to a mysql db. It's working fine. What I am trying to do is output an html page (or possibly 2) that is propagated with the data that I just sent to the db. example: when I submit a new workorder, a page comes up with all the data i just submitted. so that can be printed as a "customer copy". and in a perfect world, another page comes up that is a material order form. That can be faxed to my vendor to order the materials for that job. Not looking to auto print or fax anything. I am just having trouble getting the data into my html page. Here is what I have, but sadly is not working. <?php $link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx"); $sql = "SELECT customer FROM jobs WHERE id=6487"; echo $sql; mysqli_close($link); ?> I would like to use the data from the last id submitted and have tried several things like: WHERE id=mysqli::$insert_id and WHERE id=$insert_id with no luck. Here is a pic of the html form and the output i'm getting. Any help would be greatly appreciated. Thanks in advance. OGBugsy
  23. I got this piece of code from a free template and I followed all the instructions that came with it, everything seems fine but mail doesn't go trough. HTML: <!--Start Contact form --> <form name="enq" method="post" action="email/" onsubmit="return validation();"> <fieldset> <input type="text" name="name" id="name" value="" class="input-block-level" placeholder="Name.." /> <input type="text" name="email" id="email" value="" class="input-block-level" placeholder="Email.." /> <textarea rows="11" name="message" id="message" class="input-block-level" placeholder="Message.."></textarea> <div class="actions"> <input type="submit" value="Send!" name="submit" id="submitButton" class="btn btn-info pull-right" title="Send!" /> </div> </fieldset> </form> <!--End Contact form --> PHP: <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; $query = $_POST['message']; $email_from = $name.'<'.$email.'>'; $to="email@sample.com"; $subject="Enquiry!"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: ".$email_from."\r\n"; $message=" Name: $name <br> Email-Id: $email <br> Message: $query "; if(mail($to,$subject,$message,$headers)) header("Location:../contact.php?msg=Successful Submission! Thankyou for contacting us."); else header("Location:../contact.php?msg=Error To send Email !"); //contact:-your-email@your-domain.com } ?> JavaScript function validation() { var contactname=document.enq.name.value; var name_exp=/^[A-Za-z\s]+$/; if(contactname=='') { alert("Name Field Should Not Be Empty!"); document.enq.name.focus(); return false; } else if(!contactname.match(name_exp)) { alert("Invalid Name field!"); document.enq.name.focus(); return false; } var email=document.enq.email.value; //var email_exp=/^[A-Za-z0-9\.-_\$]+@[A-Za-z]+\.[a-z]{2,4}$/; var email_exp=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; if(email=='') { alert("Please Enter Email-Id!"); document.enq.email.focus(); return false; } else if(!email.match(email_exp)) { alert("Invalid Email ID !"); document.enq.email.focus(); return false; } var message=document.enq.message.value; if(message=='') { alert("Query Field Should Not Be Empty!"); document.enq.message.focus(); return false; } return true; } I don't get any errors but mail doesn't simply go trough, checked spam etc.
  24. Great site!, Im trying to understand a bit more pdo.. I have the following: I have a svg and when I click on the map the country name is loaded into a var on the click event by the code below: <script> function fill_contact(evt) //display click event { var country_id = evt.target.id document.getElementById('country_name').firstChild.data = country_id } </script> My php code is as follows: <?php //Define constants define('DB_DRIVER', "mysql"); define('DB_SERVER', "127.0.0.1"); define('DB_DATABASE', "aeea"); define('DB_USER', "root"); define('DB_PASSWORD', "root"); //Database connection try { $dbh = new PDO(DB_DRIVER . ":dbname=" . DB_DATABASE . ";host=" . DB_SERVER, DB_USER, DB_PASSWORD); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e){ die("Sorry, we could not connect you to this database, please contact the Administrator to sort this out.". $e->getMessage()); } //Get data $query = "SELECT firstname, lastname, email, photo FROM reps WHERE country like ?"; $country = 'country_name'; //Create the statement $stmt = $dbh->prepare($query); $stmt->execute(array($country)); //Use data $row = $stmt->fetch(PDO::FETCH_ASSOC); echo '<pre>', print_r($row), '</pre>'; ?> My Html code is as follows: <div id="IndexPage"> <div id="IndexPage_Left"> <div id="IndexPage_Left_top"> <h3>Country: <span class="label" id="country_name"> </span></h3><!—This works fine--> <p></p> <h4>Regional Representative: <span class="label" id="firstname"> </span></h3></h4><!--get Rep ” firstname, lastname” from database based on country from svg to display--> <p></p> <h4>Photo</h4><!--get Rep “photo” from database based on country from svg to display--> <p></p> <input style='margin-top: 20px;' type="submit" value="Contact me." id='jqxSubmitButton' /><!-- if clicked, it opens a contact form below, the email address is hidden--> </div> <div id="IndexPage_Left_bottom"> <h4>email form here<h4><!-- if email is clicked, it opens a contact form here with “email” address from database --> </div> </div> <div id="IndexPage_Right"> <svg id="map" version="1.1" and rest of svg code. My database has a table called reps. It had dta of representatives in each country in Africa. It has a number of fields ie. rep_id(unique indexed), firstname, lastname, email, postal, city, state, country, contact_no, photo etc. I want to be able to get the fields in the database and display them in the html form on the click events. Ie. The database must also refresh the query every time a click event happens. Guests might click a few countries to look at reps. If they click off the map, it blanks out the details. How do I go about doing this? I’ve heard about XMLHttpRequest but don’t know how to go about doing it. Another question: Once I get the information, how do I display it correctly in the Html? I used <span>, but is it correct? Last question: Once I get the information email address, how do I show a contact form on "conact me" button? and then when guests click on another country, remove the contact form? This is my first website. Please help
  25. On this dev url , the blue down "auto scroll" arrow under the headline text uses a simple anchor to jump to a spot on the page (and some javascript to slow down the scroll, but I don't think that matters as far as my question goes). As you can see, I'm also using Skrollr to animate objects and when you scroll down manually, the page kind of 'sticks' when the iMac reaches the top of the page. THAT is where I'd like the "auto scroll" arrow button to jump to and STOP. Right now, it scrolls to that spot, but then keeps going a little further. I've tried putting the anchor element in all different spots, but none get the desired resting place. That got me wondering if you can specify that an anchor scrolls down to a certain scroll position (for example, 300 pixels) rather than to an actual anchor element. In other words, my skrollr code fixes the monitor to the top of the page when the user scrolls 300 pixels. So that is where I need the "auto scroll" down arrow to jump to. Anyone know if this is possible, or have another idea? Thanks!
×
×
  • 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.