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 am trying to figure this out: i have some html and php: <div
I am having some hard times trying to figure out what file on my
I am trying out some examples with analytical functions and i have created a
I'm trying out some bean validation and I'm stumbling upon 'strange' behavior. I'm working
I'm trying to extract the price from the bellow html page/link using php cURL
I'm trying to send out a Plain/HTML multipart email out and I'm currently using
I'm currently trying to figure out a way to write a script (preferrably PHP)
I'm using php's tidy library to clean and repair some html coming from user
Ok I am learning php and trying out classes and functions. Currently I have
I'm trying to figure out a good method for loading records sequentially using some

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.