Jump to content

Recommended Posts

I'm trying to have a lot of fields data entry from user and send to SQL. It looks like it's picking up some entries and not picking up some others.

 

<tr>

        <td align="left" valign="top">House Description <span class="starmark">*</span></td>

        <td align="left" valign="top">:</td>

        <td align="left" valign="top"><textarea name="house_description" cols="50" rows="10" id="house_description"><?php echo str_replace("<br>", "\n", $house_description);?></textarea></td>

</tr>

<tr>

        <td align="left" valign="top"> Restriction <span class="starmark">*</span></td>

        <td align="left" valign="top">:</td>

        <td align="left" valign="top"><textarea name="restriction" cols="50" rows="5" id="restriction"><?php echo $restriction;?></textarea></td>

</tr>

 

Over here: there are two fields - house_description and restriction. It is picking up restriction, as I put, but not picking up the house_restriction.

 

PHP code used here:

foreach($_POST as $key => $value)

  {

    //echo '<pre>'; print_r($_POST); print_r($_GET); echo '</pre>';

   

    $$key = trim($value);

    $pass_string .= '&'. $key . '=' . trim($value);

  }

 

I tried the print_r($_POST) and found:

 

[square_feet] => $1050

[house_description] =>

[restriction] => Pets welcome, gardening place

[available_timeh] => Aug, 2011

 

You may see all other 3 fields picked up it's data, but not the house_description. Any help is greatly appreciated.

 

Thanks,

~A

 

 

 

 

 

 

Thanks PFMaBiSmAd Guru for your prompt reply. It does work. You are great!

 

But, here is new issue: I'm sharing same data structure for different types of input and it needs to share the form. How to co-relate the html input name vs. phpname vs. data structure field?

 

For example, I need to use description field for multiple types and I do not want to have multiple field for each type in my SQL data structure. Let's go for an example:

 

I have type: a, b, c

Each need description field. Each time user name choose among type (a,b,c) and the input description field from PHP code should send SQL type (a,b,c) and description. I have a code to choose, which one user picking among (a,b,c) and then the form will show description field. Can I use the same description or do I need different description and during SQL insert, I can use the corresponding variables?

 

 

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.