Jump to content

$_Get Variable With Auto-populated content?


scm22ri

Recommended Posts

How does one pass or get information into a mysql database without having the user type something into a input field? In other words, can the fields be auto-populated with information the user can't edit/change? If so, how can that be done?

 

Thanks!

Link to comment
Share on other sites

Hmm, you can set any values YOU wish. You can have the user submit a form and then completely overwrite any data they may or may not have entered with hard coded data. I'm not really sure what you are asking.

 

$favoriteSnack = $_POST['user_submitted_favorite_snack'];

if($favoriteSnack != 'Ding Dongs')
{
    //Ding dongs rule all bitches ! ! !
    $favoriteSnack = 'Ding Dongs';
}

$query = "UPDATE USERS SET favorite_snack = '$favoriteSnack' WHERE user_id = $user_id";

Link to comment
Share on other sites

This is what I mean, instead of having a user submit information I want the information to already be pre-populated. In the below URL example, for the make and model I want it to read Ford, Explorer. (It currently does) but how would I pass the value of "Ford" and "Explorer" into my mysql database?

 

http://whatsmyowncarworth.com/auto-practice/submit-information2.php

 

Thanks

Link to comment
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.