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

  • Home
  • SEARCH
  • 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 8055275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:20:12+00:00 2026-06-05T08:20:12+00:00

I have a form that e-mails the form data to a e-mail address. I

  • 0

I have a form that e-mails the form data to a e-mail address. I am also wanting to store this information into a database. The problem I am running into is I am pulling information from one table, online_rental_db so that the information from that can be sent to us. I am wanting to also store the form information into another table online_rental_request.

<?php

$rentID = $_POST['current_id'];

$db=mysql_connect ("localhost","test","test") or die(mysql_error());
mysql_select_db("rentals");

$table="online_rental_db";
$sql = "SELECT * FROM $table WHERE ID=$rentID";
$query = mysql_query($sql) or die(mysql_error());
$rentals = mysql_fetch_assoc($query);
$description = ucwords(strtolower($rentals['Description']));
$image = $rentals['Image'];
$download = $rentals['PDF'];
$bytes =  filesize($rentals['PDF']);
$ID = $rentals['ID'];
$CTGID = $rentals['CTGID'];
$category = $rentals['Category'];
$model = $rentals['model'];

I have tried using on the $sql to do

$sql = "SELECT * FROM $table WHERE ID=$rentID INSERT INTO online_rental_request (name, email, id, description, model, category) VALUES ('$_POST[name]','$_POST[email]','$rentID','$description','$model','$category')";

but it gives me a sql error!

  • 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-06-05T08:20:13+00:00Added an answer on June 5, 2026 at 8:20 am

    If you mean to insert into the online_rental_request table directly from online_rental_db table, you should do the following:

    $name = mysql_escape_string($_POST['name']);
    $email = mysql_escape_string($_POST['email']);
    $sql = "INSERT INTO online_rental_request (name, email, id, description, model, category) SELECT '$name', '$email', id, description, model, category FROM $table WHERE ID=$rentID";
    

    By the way, you should not forget to escape your user-submitted values. You should do this:

    $rentID = mysql_escape_string($_POST['current_id']);
    

    OR, better
    $rentID = (int)$_POST[‘current_id’];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that customers fill in with personal data and also makes
I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
I have a form that and after the user fills in this form, I
I have a form that collects information, one piece of which is a phone
I have one contact form, that send the email to one of Address selected
Hey I have this code that sends an email with some data sent by
I have a form field for E-mail address and I want to set up
I have this weird situation where my form doesn't send any data, but the
I currently have form that checks if a user has unsubmitted changes when they
We have a form that hosts the WebBrowser control. That is the only control

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.