Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3314486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:14:19+00:00 2026-05-17T22:14:19+00:00

Trying out some things with php and html, I’m having issues trying to get

  • 0

Trying out some things with php and html, I’m having issues trying to get all of my form data reposted. I’ve figured out how to do the text boxes. Still at a loss for the select box, radio and check box. Would I be better off reposting inside the HTML page or letting my include template code take care of it?

 <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="css/rocks.css">
    <title>About Us-- Rocks</title>
</head>
<body> 
  <?php include("templates/banner_navigation.php"); ?>
  <div id="links_group">
  <?php include("templates/menu.php"); ?> <!-- 1st include for navigation, stored in templates  -->
  </div>
   <div id="about_us_form">
       <?php include("templates/about_us_valid.php"); ?>
       <form action="<?php echo $PHP_SELF;?>" method="post">
       <table>
       <tr><td>First name:</td><td><input type="text" name="contact_name" title="Enter your first name here" value="<?php if (isset($_POST['contact_name'])) echo $_POST['contact_name']; ?>" /></td></tr>
       <tr><td>Email Address:</td><td><input type="text" name="contact_email" title="Enter your email here" value="<?php if (isset($_POST['contact_email'])) echo $_POST['contact_email']; ?>" ></td></tr>
       <tr><td>Phone Number:</td><td><input type="text" name="contact_phone_number" title="555-555-5555" value="<?php if (isset($_POST['contact_phone_number'])) echo $_POST['contact_phone_number']; ?>" /></td></tr>
       <tr><td>I prefer to be contacted by:</td><td><input type="radio" name="preference" value="Email" checked/>Email<input type="radio" name="preference" value="Phone" />Phone</td></tr>
       <tr><td>I am interested in:</td> <td><select name="select_rocks"><option value="gold">Gold</option>
             <option value="silver">Silver</option>
             <option value="thorium" selected="selected">Thorium</option>
             <option value="titanium">Titanium</option>
             </select></td></tr>
       <tr><td>  I would like to ask about:</td></tr>
       <tr><td><textarea name="that_textarea" rows ="10" cols="25" title="Enter your questions here!">
       </textarea></td></tr>
       <tr><td>I am also interested in:</td><td>
       <tr><td>Gemstones <input type="checkbox" name="checkbox1[]" value="gemstones" /></td><tr>
       <tr><td>Ore processing <input type="checkbox" name="checkbox1[]" value="oreprocessing" /></td></tr>
       <tr><td><input type="hidden" name="checkbox1[]" value="" /> </td><tr>

       <tr><td><input type="submit" value="submit" name="submitform" /></td></tr>

       </table><br/>
       </form>

  </div>
</body>

the include template:

   <?php
   function check_for_cat($namecheck=false,$emailcheck=false){
       if ($namecheck) $name_field_error = "(((Name Invalid!)))";
       if ($emailcheck) $email_field_error = "(((Email Invalid!)))";
       //Start of form
       if($namecheck) echo "<tr><td>$name_field_error</td></tr>";
       if($emailcheck) echo "<tr><td>$email_field_error</td></tr>";

   }

       if (!isset($_POST['submitform'])) {
       check_for_cat();
       } else {
          $namecheck = false;
          $emailcheck = false;


          $contact_name = isset($_POST['contact_name']) ? trim($_POST['contact_name'])  : '';
          $contact_email = isset($_POST['contact_email']) ? trim($_POST['contact_email'])  : '';
       if (strlen($contact_name)<3)  $namecheck = true;
       if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $contact_email)) $emailcheck=true;
       if ($namecheck || $emailcheck ){
       check_for_cat($namecheck,$emailcheck);

       } else {
       echo '(((OMG the form is submitted!)))';
   }
}
   ?>

Its probably pretty easy to do, I’ve just been looking at the code for too long, Thanks for the help! If possible put some code up, google and yahoo haven’t found me much to look at.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:14:19+00:00Added an answer on May 17, 2026 at 10:14 pm

    For use Selected Option …

    Both radio and checkbox inputs with work with checked=”checked” in order for them to be checked. You must use some php logic to determine if the user’s input matches the necessary input to check the radio/checkbox and dropdown. For instance:

    <input type="checkbox" <?php if ($userval == $boxval) echo 'checked="checked"'; ?> />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning Erlang and am trying out some Project Euler problems
I'm trying to find out some matrix multiplication/inversion benchmarks online. My C++ implementation can
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I am trying to separate some asp logic out into a separate page. For
I am trying to export some prepared assets out of Expression Design 2 and
I'm trying out my first Spring project and must be doing something really stupid
I'm trying to figure out a way to automatically cast something to an Action
I'm currently trying out db4o (the java version) and I pretty much like what
I'm trying out the following query: SELECT A,B,C FROM table WHERE field LIKE 'query%'
I am trying out the debugger built into Zend studio . It seems great!

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.