Jump to content

palash4003

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

palash4003's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Dear Support, Here is my code: <?php if ( strtolower($_SERVER['REQUEST_METHOD']) === 'post' ) { $name = isset($_POST['name]) ? htmlspecialchars($_POST['name']) : ""; $area = isset($_POST['area']) ? htmlspecialchars($_POST['area']) : ""; $choice = isset($_POST['choice ']) ? htmlspecialchars($_POST['choice ']) : ""; //Do Others } ?> <form class="customersForm" method="post"> <div class=""> <p>Name<br /> <select style="width:120px;" name="name"> <?php $sql = "select * from `name_info` order by `name`"; $query = mysql_query($sql); $dd = '<option>Name</option>'; while($row = mysql_fetch_object($query)) { $dd .= '<option>'.$row->name.'</option>'; } echo $dd; ?> </select> </p> </div> <div class=""> <p>Area<br /> <select style="width:120px;" area="area"> <?php $sql = "select * from `area_info` order by `area`"; $query = mysql_query($sql); $dd = '<option>Area</option>'; while($row = mysql_fetch_object($query)) { $dd .= '<option>'.$row->area.'</option>'; } echo $dd; ?> </select> </p> </div> <div class=""> <p>Choice<br /> <select style="width:120px;" choice="choice"> <?php $sql = "select * from `choice_info` where `name`='".$name."' and `area`='".$area."' order by `choice`"; $query = mysql_query($sql); $dd = '<option>Choice</option>'; while($row = mysql_fetch_object($query)) { $dd .= '<option>'.$row->choice.'</option>'; } echo $dd; ?> </select> </p> </div> ......//Others input fields ...some text fields ... </ form> I have the above code, where I would like to show the choice Drop-down box, depends on $name and $area match of the choice_info table. $name field and $area field needs to have any dependency and straight from the MySQL table. But, choice needs to depend on $name & $area. How can I do it without much using Javacript? I do not mind to use JavaScript, but prefer to minimal. By the way, I will have some other input fields too. It's an input form but, one drop-down box will be depends on two others choice. Thanks for your help.
  2. Hi SergeiSS, Thanks for your prompt reply with the page link. There is only one issue here: If I go to the registration page first time, it is all these messages - like "Name is invalid" whatever I put at echo message. It's only I want when user click on the submit button. By the way, I have a image button, instead of submit like type="image" <?php $name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : ""; if ($name == "") { echo "Name is invalid<br>"; } ?> Any more help? I appreciate.
  3. Thanks SergeiSS. You are great! Simple solution and that works for me.
  4. I have a form, where I'm collecting registration info - like name, address, email, password. I'm calling another php file at server side code, where it will check whether the email exists or not. Pretty simple, just receiving those post variables and check with the database. The issue, if I find a match, I want to go back to the registration.php page, using the following code: if ($email_already_use == "y") { $_SESSION['ERROR'] = "Error"; $_SESSION['MESSAGE'] = "This email address already used. Please try another"; header("location: ".$settings['site_url']."registration.php"); exit; } Now, I would like to place the user input at the registration.php file, but I do not want to use pass variable at URL like this: header("location: ".$settings['site_url']."registration.php?".name=$name&address=$address&email=$email; Is there anyway, I can retrieve those variables at registration.php, without specifying .name=$name&address=$address&email=$email ? Thanks for your help. I see some sites has similar implementation, but did not find anything like how to do it.
  5. Hi Support, I have a form, where it collects user description input. I can collect the inputs and store it with newline. The issue is - how to collect the http link to actual hyperlink ref during display. The following is my code: <textarea name="description" cols="50" rows="10" id="description"><?php echo str_replace("<br>", "\n", $description);?></textarea></td> For example, User input: Hi, Check it out - http://www.google.com/ I would like to display google link as href so that Viewers can click the link and go to the page. Right now, it is not href and user need to copy the link to new tabs or pages and then it can come. Thanks for your help. Regards, Ahsan
  6. Thanks PFMaBiSmAd Guru. I figured out rest, but that was the clue of sharing the same form name. You are really a guru indeed! I truly appreciate your help!! Long live phpfreaks!
  7. 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?
  8. 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
×
×
  • 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.