Object not found XAMPP PHP error - php

I am trying to run a php file using xampp but I'm getting the Object not found error, I watched some videos where people say create another folder and run it under that but that is not working for me! look at the screenshot below and please if you could help me understand why this isn't working
enter image description here
Please note even if i use another file such as footer.php i get the same error.
here is the code for mens.php i didnt include it in the screenshot
<?php
session_start();
//unset($_SESSION['basket']);
?>
<!DOCTYPE html>
<html>
<head>
<!-- External Stylesheet -->
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Mens</title>
</head>
<body>
<div class="bar">Sale Now On!</div>
<div id="outer">
<?php
include('header.php');
?>
<!-- All content will be wrapped insisde this container -->
<div id="container">
<!-- Page -->
<h2>Mens Clothing</h2>
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="headings">
<th style="width: 20%;">Photo</th>
<th style="width: 30%;">Desciption</th>
<th style="width: 10%;">Size</th>
<th style="width: 10%;">Price</th>
<th style="width: 10%;">Qty</th>
<th style="width: 20%;">Action</th>
</tr>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Contempary Hugo Boss
Suit</td>
<input type="hidden" name="itemdesc" value="Contempary Hugo Boss
Suit" />
<input type="hidden" name="sku" value="100" />
<input type="hidden" name="pic" value="suit.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£500.00</td>
<input type="hidden" name="price" value="500.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit1.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Wool Hugo Boss Suit</td>
<input type="hidden" name="itemdesc" value="Wool Hugo Boss Suit"
/>
<input type="hidden" name="sku" value="101" />
<input type="hidden" name="pic" value="suit1.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£450.00</td>
<input type="hidden" name="price" value="450.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
</table>
</div>
</div>
<?php
include('footer.php');
?>
</body>
</html>

A file called ._mens.php Is NOT the same as a file called mens.php
As you are using the url localhost/example/mens.php then the file needs to be called mens.php

Related

Valid Regex Not so valid in PHP [duplicate]

This question already has answers here:
Warning: preg_replace(): Unknown modifier
(3 answers)
Closed 5 years ago.
So i want to extract everything in between form tags (including the tags them selves).
The form is as below:
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
Regex i am using is: <form.*>[\s\S]*<\/form> and according to regex101 This is a valid regular expression that should extract form tags + everthing in between.
However using the above regular expression in preg_match i get the following error: Warning: preg_match(): Unknown modifier '['
Not sure what you actual issue is. For me your pattern works like charm:
<?php
$markup = <<<HTML
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
HTML;
preg_match('~<form.*>([\s\S]*)</form>~', $markup, $tokens);
var_dump($tokens[1]);
The output of that is:
string(829) "
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
"
The only modification I made is to add the capture group ((...)) to be able to actually extract something.
You are escaping the forward slash in the closing </form> tag with a back slash. Most likely that is because online regex tools like regex101 use forward slashes as standard delimiters in their patterns. Note that you can use other characters which makes the pattern easier to read, since you do not have to escape characters then...
I suspect that you maybe forgot to place your pattern in between delimiters?

PHP, HTML, MySql Form refuses to post

I have made many forms but for some unknown reason I cannot get this one to work. I hit submit and it just stays on the same page and all the inputs just go empty. Maybe a fresh pair of eyes would see something I do not. I have tried putting the PHP in a separate file, double/triple checked the input statement and everything else and just can't see it whatever it is.
This is the table:
CREATE TABLE `store_orders` (
`id` int(11) NOT NULL,
`order_date` varchar(70) NOT NULL,
`order_first_name` varchar(50) NOT NULL,
`order_last_name` varchar(50) NOT NULL,
`order_address` varchar(255) NOT NULL,
`order_city` varchar(50) NOT NULL,
`order_state` char(50) NOT NULL,
`order_zip` varchar(10) NOT NULL,
`order_tel` varchar(25) NOT NULL,
`order_email` varchar(100) NOT NULL,
`cc_type` varchar(30) NOT NULL,
`cc_number` int(16) NOT NULL,
`cc_expmonth` int(2) NOT NULL,
`cc_expyear` int(2) NOT NULL,
`cc_cvc` int(3) NOT NULL
)
Here's the PHP at the top of the page:
<?php
session_start();
//connect to database
$con = mysqli_connect("localhost", $username, #pw, $db);
$error = false;
if (isset($_POST['checkout'])) {
$datetime = mysqli_real_escape_string($con, $_POST['order_date']);
$fname = mysqli_real_escape_string($con, $_POST['order_first_name']);
$lname = mysqli_real_escape_string($con, $_POST['order_last_name']);
$address = mysqli_real_escape_string($con, $_POST['order_address']);
$city = mysqli_real_escape_string($con, $_POST['order_city']);
$state = mysqli_real_escape_string($con, $_POST['order_state']);
$zip = mysqli_real_escape_string($con, $_POST['order_zip']);
$phone = mysqli_real_escape_string($con, $_POST['order_tel']);
$email = mysqli_real_escape_string($con, $_POST['order_email']);
$cardtype = mysqli_real_escape_string($con, $_POST['cc_type']);
$cardnumber = mysqli_real_escape_string($con, $_POST['cc_number']);
$cardmonth = mysqli_real_escape_string($con, $_POST['cc_expmonth']);
$cardyear = mysqli_real_escape_string($con, $_POST['cc_expyear']);
$cardcvc = mysqli_real_escape_string($con, $_POST['cc_cvc']);
$fname = stripslashes($fname);
$lname = stripslashes($lname);
$address = stripslashes($address);
$city = stripslashes($city);
$zip = stripslashes($zip);
$phone = stripslashes($phone);
$email = stripslashes($email);
$cardtype = stripslashes($cardtype);
$cardnumber = stripslashes($cardnumber);
$cardmonth = stripslashes($cardmonth);
$cardmonth = stripslashes($cardmonth);
$cardyear = stripslashes($cardyear);
$cardcvc = stripslashes($cardcvc);
if (!preg_match("/^[a-zA-Z ]+$/",$fname)) { /* name can contain only alpha characters and space */
$error = true;
$name_error = "Name must contain only letters"; }
if (!preg_match("/^[a-zA-Z ]+$/",$lname)) { /* name can contain only alpha characters and space */
$error = true;
$name_error = "Name must contain only letters"; }
if (!preg_match("/^[a-zA-Z-0-9 ]+$/",$address)) { /* letters and numbers */
$error = true;
$user_name_error = "Address can contain only letters and numbers"; }
if (!preg_match("/^[a-zA-Z-0-9 ]+$/",$city)) { /* letters and numbers */
$error = true;
$user_name_error = "City can contain only letters and numbers"; }
if(!filter_var($email,FILTER_VALIDATE_EMAIL)) { /* will accept only email addresses */
$error = true;
$email_error = "Please Enter Valid Email ID"; }
if (!$error) {
if(mysqli_query($con, "INSERT INTO store_orders(order_date, order_first_name, order_last_name, order_address, order_city , order_state, order_zip, order_tel, order_email, cc_type, cc_number, cc_expmonth, cc_expyear, cc_cvc ) VALUES('".$datetime."','".$fname."','".$lname."','".$address."','".$city."','".$state."','".$zip."','".$phone."','".$email."','".$cardtype."','".$cardnumber."','".$cardmonth."','".$cardyear."','".$cardcvc."')"));
header('Location: checkout-view.php');
} else {
$errormsg = "Error completing form...Please try again!"; /* if register is not successful */
}
}
?>
This is the form... on the same page...
<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
</head>
<body style="background-color: #f9ecf2;">
<div class="container">
<div class="col-md-8 col-sm-8 grad" style="background-color: ; margin-right: 0px; margin-left: 0px; border-bottom-style: solid; border-bottom-color: #4d004d; border-bottom-width: 1px; padding-left: 0px;">
<!-- begin middle column -->
<!-- InstanceBeginEditable name="EditRegion3" -->
<div style='width: 85%; margin-left: auto; margin-right: auto;'>
<br>
<br>
<br>
<form role="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="checkout">
<table width="100%" border="0" class="responsive">
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Date - Time</b5>
</td>
<td>
<b3 style="font-size: 12pt;">
<input name="order_date" id="order_date" type="text" value="<?php echo date('m/d/y');?>" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">First Name:</b5>
</td>
<td>
<b3 style="font-size: 12pt;">
<input name="order_first_name" id="order_first_name" type="text" size="50" maxlength="50" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Last Name:</b5>
</td>
<td>
<b3 style="font-size: 12pt;">
<input name="order_last_name" id="order_last_name" type="text" size="50" maxlength="40" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Address:</b5>
</td>
<td>
<b3 style="font-size: 12pt;">
<input name="order_address" id="order_address" type="text" size="50" maxlength="255" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">City:</b5>
</td>
<td>
<b3 style="font-size: 12pt;">
<input name="order_city" id="order_city" type="text" size="50" maxlength="50" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" width="30%" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Select State:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<select name="order_state" id="order_state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Zip Code:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="order_zip" id="order_zip" type="text" size="50" maxlength="10" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Phone:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="order_tel" id="order_tel" type="text" size="50" maxlength="25" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Email Address:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="order_email" type="email" id="order_email" size="50" maxlength="100" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Select Card Type:</b5>
</td>
<td style=" padding-top: 5px; font-size: 24pt; color: #4d004d">
<p>
<b5>
<img src="img/cc-mastercard.png" width="75" height="49" alt="" />
<input type="radio" name="cc_type" value="Mastercard">
<img src="img/cc-visa.png" width="75" height="49" alt="" />
<input type="radio" name="cc_type" value="Visa">
<img src="img/cc-american-express.png" width="75" height="49" alt="" />
<input type="radio" name="cc_type" value="American Express">
<img src="img/cc-paypal.png" width="75" height="49" alt="" />
<input type="radio" name="cc_type" value="PayPal">
</b5>
</p>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Card Number:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="cc_number" type="integer" id="cc_number" size="50" maxlength="16" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">Expiration:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="cc_expmonth" type="integer" id="cc_expmonth" size="2" maxlength="2" required="required" /><span Style='font-size: 18pt; color: #4d004d'><b3>&nbsp/&nbsp</span>
</b3>
<input name="cc_expyear" type="integer" id="cc_expyear" size="2" maxlength="2" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;">
<b5 style="text-align: right; line-height: 80%; font-size: 16pt; color: black;">CVC Code:</b5>
</td>
<td style=" padding-top: 5px;">
<b3 style="font-size: 12pt;">
<input name="cc_cvc" type="integer" id="cc_cvc" size="3" maxlength="3" required="required" />
</b3>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-left: 15px; padding-right: 10px; padding-top: 10px;"></td>
<td style=" padding-top: 5px;">
<b5 style="font-size: 12pt;">
<input name="submit" type="submit" value="Submit" /><span>&nbsp&nbsp&nbsp</span>
<input name="reset" type="reset" value="Reset" />
</b5>
</td>
</tr>
</table>
</form>
</div>
<br>
<br>
<br>
<!-- InstanceEndEditable -->
</div>
<!-- end middle column -->
</body>
<!-- InstanceEnd -->
</html>
The connection is right. I've got about an hour to turn this assignment in so, at midnight (EST), the semester is over. Good thing I made 100's on everything else this Fall...... I have made countless forms over the past year or more and never had a problem.....
Change the name of the submit button to "checkout" and remove the name="checkout" from the form.

html <select> --> no upload from selected statement

I am working on a form for a newsletter questionairy. There I have some trouble with some selected statements. The statements which can be selected (value="f" and value "m") will not be uploaded onto the mail server. Maybe someone of you has a solution. The FirstNAme, LAstName and EMail are working.
Here is the code:
<div style="margin-right:auto;margin-left:auto;width:720px">
<form id="nl2go--form" action="https://app.newsletter.com/de/recipients/index/subscribe/" method="post" accept-charset="utf-8">
<table border="0" align="center">
<tr>
<td><select name="n1go-gender" style="font-size:9pt; background:border: 1px solid #181717; padding: 2px; width: 45pt;" onchange="alert(this.form.n1go-gender.options[this.form.n1go-gender.selectedIndex].value)">
<option value="f" selected>Woman</option>
<option value="m">Mister</option>
</select> <input type="text" name="nl2go-firstname" id="nl2go--firstname" style="font-size:9pt; color:#181717; background:border: 1px solid #181717; padding: 2px; width: 107pt;" placeholder="FirstName"/> <input type="text" name="nl2go--lastname" id="nlgo-lastname" style="color:#181717; font-size:9pt; width:107pt; background border: 1px solid #181717; padding: 2px;" placeholder="LastName"/></td>
<tr>
<td><input type="text" name="nl2go-mail" id="nlgo--mail" style="font-size:9pt; width:272pt; background border: 1px solid #cccccc; padding: 2px;" placeholder="Your E-Mail"></td>
<tr>
<td align="center"><input type="submit" value="Senden" name="nlgo-submit" id="nlgo-submit" class="jfk-button jfk-button-action">
<input type="hidden" name="nl2go--key" id="nl2go--key" value="dfdfdfdf....."></div></td></tr></table></div></ol>
</form
cheers
Vrede
Ugly. You have syntax issues on this line:
</div></td></tr></table></div></ol>
Thus, breaking your code/form.
Also, try using classes for styling opposed to inline styles.

updating filtered mysql rows in php

I'm trying to update different rows from mysql that they filtered by some record . in this code first the user should enter two input : classnumber and level .
records that they have this fields will show in table then the user should be able to update this records information . but the problem is all of records are in one table in mysql so their id is different I mean for example the first record that match with two inputs id is 2 and then the next one is 5 and next one 6 and ....
with this kind of situation how should I change the code below ?
<form id="searchform" method="post" dir="rtl" action="">
level :<input name="level" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="level" />
classnumber :<input name="classnum" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="classnum" />
<input style="margin-top:10px; margin-left:120px; font-size: 14px; padding: 5px 14px;" type="submit" value="جستجو" name="enter" />
</form>
<?php
if(isset($_POST['enter'])){
$sql="SELECT * FROM `".$tbl_name."` where classnum='".$_REQUEST['classnum']."' and level='".$_REQUEST['level']."' ";
$result=mysql_query($sql,$link);
$count=mysql_num_rows($result);
}
?>
<div class="cleaner h30"></div>
<br>
<form name="form1" action="" method="POST">
<center>
<div>
<div align="center" width = 615>
<table class="stats" cellspacing="0" width="615" border="1">
<tr>
<th width="20" scope="col" >Id</th>
<th width="60" scope="col">Name</th>
<th width="60" scope="col">Last Name</th>
<th width="42" scope="col">Midterm</th>
<th width="54" scope="col">Class mark</th>
<th width="42" scope="col">Final Quiz</th>
<th width="54" scope="col">State</th>
<th width="54" scope="col">Details</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
$id[]=$rows['id'];
?>
<tr>
<td align="center">
<input name="id[]" type="text" id="id" value="<? echo $rows['id']; ?>" style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 10px;"></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="name[]" id="name" value= "<? echo $rows['name']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="lastname[]" id="lastname" value= "<? echo $rows['lastname']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="midmark[]" id="midmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="classmark[]" id="classmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="finalmark[]" id="finalmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="state[]" id="state" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="details[]" id="details" /></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</center>
<input style="margin-top:10px; float:right; margin-right:175px; font-size: 14px; padding: 5px 14px;" type="submit" value="ثبت" name="Submit" />
</form>
<?php
// Check if button name "Submit" is active, do this
if(isset($_POST['Submit']))
{
for($i=0;$i<$count;$i++)
{
$sql1=mysql_query(" UPDATE `".$tbl_name."` SET midmark='".$_REQUEST['midmark'][$i]."' , classmark='".$_REQUEST['classmark'][$i]."' , finalmark='".$_REQUEST['finalmark'][$i]."' , state='".$_REQUEST['state'][$i]."' , details='".$_REQUEST['details'][$i]."' WHERE id='".$_REQUEST['id'][$i]."' "); $result1=mysql_query($sql1);
}
}
if($result1){
header("location:results.php");
}
mysql_close();
?>

Show download file option on click [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i need to show the download file option once the user fills the below email and name form -- Here is the form
<form action="process.php" method="post">
<input type="hidden" name="bot_action" value="form_subscribe" /> <input
type="hidden" name="bot_track_code" value="1" /> <input type="hidden"
name="bot_pass_standard" value="0" /> <input type="hidden"
name="bot_pass_custom" value="0" /> <input type="hidden"
name="bot_account" value="howtopossibleit" /> <input type="hidden"
name="bot_redirect" value="" /> <input type="hidden"
name="bot_web_form_id" value="44640" />
<table width="230" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="10" width="10%" align="left" valign="middle"></td>
<td height="10" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 0px 0px 0px;">
<div align="center">Name:</div>
</div></td>
<td height="10" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 1px 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="fullname" value="" /></td>
</tr>
<tr>
<td height="31" width="10%" align="left" valign="middle"></td>
<td height="15" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 5px 0px 0px;">
<div align="center">Email:</div>
</div></td>
<td height="15" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 21x 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="email" value="" /></td>
</tr>
<tr>
<td height="15" colspan="3" align="center" valign="middle"><table
style="border: 1px solid #363636;" cellpadding="0" cellspacing="0">
<tr style="background-color: #e8e8e8; color: #FFFFFF;">
<td width="234" height="26" align="center" bgcolor="#FF0000"
style="border-top: 1px solid #ffffff; border-left: 1px solid #ffffff;"><input
type="submit"
style="overflow: auto !important; overflow: visible; width: auto !important; width: 55px; margin: 0px 15px 0px 15px; border: 0px; background-color: #FF0000; font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636;"
name="submit2" value="SUBMIT, Than press Download" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="4" colspan="3" valign="middle"
style="padding: 3px 0px 3px 0px;"></td>
</tr>
</table>
</form>
Here is the download file code:
DownloadFile: <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download">
Set the code in a div and make it display:none initially..
<div id="link" style="display:none"> <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download"></div>
call this jquery function in onblur event of both name & email field
function enableLink() {
if($("#name").val() != "" && $("#email").val() != "")
$("#link").show();
else
$("#link").hide();
}

Categories